Changed links of proxies and of rest service
This commit is contained in:
parent
bf6b4fe913
commit
b587a2d151
|
@ -1,9 +1,9 @@
|
|||
package dao.entities.security;
|
||||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.security.UserInfo;
|
||||
import entities.UserInfo;
|
||||
|
||||
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package dao.entities.security;
|
||||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -7,8 +7,8 @@ import javax.persistence.NoResultException;
|
|||
import javax.persistence.TypedQuery;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.UserInfo;
|
||||
import entities.security.UserAuth;
|
||||
import entities.security.UserInfo;
|
||||
|
||||
|
||||
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
|
@ -88,6 +88,14 @@ public class DMP implements Serializable {
|
|||
private Set<Researcher> researchers;
|
||||
|
||||
|
||||
// @OneToMany(fetch = FetchType.EAGER)
|
||||
// @JoinTable(name="\"UserDMP\"",
|
||||
// joinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")},
|
||||
// inverseJoinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")}
|
||||
// )
|
||||
// private Set<UserInfo> users;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -168,6 +176,15 @@ public class DMP implements Serializable {
|
|||
this.researchers = researchers;
|
||||
}
|
||||
|
||||
|
||||
// public Set<UserInfo> getUsers() {
|
||||
// return users;
|
||||
// }
|
||||
//
|
||||
// public void setUsers(Set<UserInfo> users) {
|
||||
// this.users = users;
|
||||
// }
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
//package entities;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//import javax.persistence.Column;
|
||||
//import javax.persistence.Entity;
|
||||
//import javax.persistence.GeneratedValue;
|
||||
//import javax.persistence.Id;
|
||||
//import javax.persistence.Table;
|
||||
//
|
||||
//import org.hibernate.annotations.GenericGenerator;
|
||||
//import org.hibernate.annotations.Type;
|
||||
//
|
||||
//import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
//import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
//
|
||||
//@Entity
|
||||
//@Table(name="\"UserInfo\"")
|
||||
//@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
||||
//public class UserDMP implements Serializable{
|
||||
//
|
||||
// private static final long serialVersionUID = -4467370784003784660L;
|
||||
//
|
||||
//
|
||||
// @Id
|
||||
// @GeneratedValue
|
||||
// @GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
// @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
// private UUID id;
|
||||
//
|
||||
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
// @Column(name = "user", nullable = false)
|
||||
// private UUID user;
|
||||
//
|
||||
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
// @Column(name = "dmp", nullable = false)
|
||||
// private UUID dmp;
|
||||
//
|
||||
// @Column(name = "role")
|
||||
// private Integer role;
|
||||
//
|
||||
// public UUID getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(UUID id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public UUID getUser() {
|
||||
// return user;
|
||||
// }
|
||||
//
|
||||
// public void setUser(UUID user) {
|
||||
// this.user = user;
|
||||
// }
|
||||
//
|
||||
// public UUID getDmp() {
|
||||
// return dmp;
|
||||
// }
|
||||
//
|
||||
// public void setDmp(UUID dmp) {
|
||||
// this.dmp = dmp;
|
||||
// }
|
||||
//
|
||||
// public Integer getRole() {
|
||||
// return role;
|
||||
// }
|
||||
//
|
||||
// public void setRole(Integer role) {
|
||||
// this.role = role;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -1,7 +1,8 @@
|
|||
package entities.security;
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
@ -10,6 +11,8 @@ import javax.persistence.FetchType;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -21,10 +24,12 @@ import org.hibernate.annotations.Type;
|
|||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
import entities.security.UserAuth;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"UserInfo\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class UserInfo implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1225151430484658395L;
|
||||
|
@ -68,6 +73,14 @@ public class UserInfo implements Serializable{
|
|||
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
||||
private String additionalinfo;
|
||||
|
||||
// @OneToMany(fetch = FetchType.EAGER)
|
||||
// @JoinTable(name="\"UserDMP\"",
|
||||
// joinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")},
|
||||
// inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
|
||||
// )
|
||||
// private Set<UserInfo> users;
|
||||
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
|
@ -21,10 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import dao.entities.UserInfoDao;
|
||||
import dao.entities.security.UserAuthDao;
|
||||
import dao.entities.security.UserInfoDao;
|
||||
import entities.UserInfo;
|
||||
import entities.security.UserAuth;
|
||||
import entities.security.UserInfo;
|
||||
import security.TokenSessionManager;
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package rest.proxy;
|
||||
package proxy;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -57,12 +57,12 @@ public class Proxy {
|
|||
while ((inputLine = in.readLine()) != null)
|
||||
response.append(inputLine);
|
||||
in.close();
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
||||
}
|
||||
else {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'Remote server responded with: "+responseCode+"'}");
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
||||
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
||||
}
|
|
@ -257,6 +257,7 @@ public class Datasets {
|
|||
try {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ public class Projects {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.security.core.Authentication;
|
|||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import dao.entities.security.UserInfoDao;
|
||||
import entities.security.UserInfo;
|
||||
import dao.entities.UserInfoDao;
|
||||
import entities.UserInfo;
|
||||
import exceptions.NonValidTokenException;
|
||||
import security.validators.GoogleTokenValidator;
|
||||
import security.validators.NativeTokenValidator;
|
||||
|
@ -64,7 +64,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
|||
else
|
||||
throw new AuthenticationServiceException("Authentication failed");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.google.api.client.http.HttpTransport;
|
|||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||
|
||||
import entities.security.UserInfo;
|
||||
import entities.UserInfo;
|
||||
import exceptions.NonValidTokenException;
|
||||
|
||||
public class GoogleTokenValidator implements TokenValidator {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<bean id="nativeTokenValidator" class="security.validators.NativeTokenValidator" />
|
||||
|
||||
|
||||
<bean id="proxy" class="rest.proxy.Proxy">
|
||||
<bean id="proxy" class="proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
|
@ -100,7 +100,7 @@
|
|||
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
||||
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
||||
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
||||
<bean id="userInfoDao" class="dao.entities.security.UserInfoDaoImpl" />
|
||||
<bean id="userInfoDao" class="dao.entities.UserInfoDaoImpl" />
|
||||
<bean id="userAuthDao" class="dao.entities.security.UserAuthDaoImpl" />
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
|
||||
<!-- <context:property-placeholder location="classpath*:**/dmp.properties" /> -->
|
||||
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||
|
||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||
<mvc:annotation-driven />
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||
|
||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="proxy" />
|
||||
|
||||
|
||||
<bean id="proxy" class="proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="multipartResolver"
|
||||
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<property name="maxUploadSize" value="100000000" />
|
||||
</bean>
|
||||
|
||||
<bean id="jsonConverter"
|
||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||
<property name="prefixJson" value="false" />
|
||||
<property name="supportedMediaTypes" value="application/json" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||
<property name="messageConverters">
|
||||
<list>
|
||||
<ref bean="jsonConverter" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -16,9 +16,7 @@
|
|||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="rest" />
|
||||
|
||||
<bean id="proxy" class="rest.proxy.Proxy">
|
||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
|
|
|
@ -3,7 +3,20 @@
|
|||
|
||||
<display-name>dmp-backend</display-name>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||
<url-pattern>/proxy/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dmp-backend-login</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
|
|
Loading…
Reference in New Issue