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 java.util.UUID;
|
||||||
|
|
||||||
import dao.Dao;
|
import dao.Dao;
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
|
|
||||||
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
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.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -7,8 +7,8 @@ import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import dao.JpaDao;
|
import dao.JpaDao;
|
||||||
|
import entities.UserInfo;
|
||||||
import entities.security.UserAuth;
|
import entities.security.UserAuth;
|
||||||
import entities.security.UserInfo;
|
|
||||||
|
|
||||||
|
|
||||||
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
|
@ -88,6 +88,14 @@ public class DMP implements Serializable {
|
||||||
private Set<Researcher> researchers;
|
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() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -168,6 +176,15 @@ public class DMP implements Serializable {
|
||||||
this.researchers = researchers;
|
this.researchers = researchers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public Set<UserInfo> getUsers() {
|
||||||
|
// return users;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setUsers(Set<UserInfo> users) {
|
||||||
|
// this.users = users;
|
||||||
|
// }
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
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.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
@ -10,6 +11,8 @@ import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -21,10 +24,12 @@ import org.hibernate.annotations.Type;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
||||||
|
import entities.security.UserAuth;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"UserInfo\"")
|
@Table(name="\"UserInfo\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||||
public class UserInfo implements Serializable{
|
public class UserInfo implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1225151430484658395L;
|
private static final long serialVersionUID = 1225151430484658395L;
|
||||||
|
@ -68,6 +73,14 @@ public class UserInfo implements Serializable{
|
||||||
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
||||||
private String additionalinfo;
|
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() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
|
@ -21,10 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import dao.entities.UserInfoDao;
|
||||||
import dao.entities.security.UserAuthDao;
|
import dao.entities.security.UserAuthDao;
|
||||||
import dao.entities.security.UserInfoDao;
|
import entities.UserInfo;
|
||||||
import entities.security.UserAuth;
|
import entities.security.UserAuth;
|
||||||
import entities.security.UserInfo;
|
|
||||||
import security.TokenSessionManager;
|
import security.TokenSessionManager;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package rest.proxy;
|
package proxy;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -57,12 +57,12 @@ public class Proxy {
|
||||||
while ((inputLine = in.readLine()) != null)
|
while ((inputLine = in.readLine()) != null)
|
||||||
response.append(inputLine);
|
response.append(inputLine);
|
||||||
in.close();
|
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.FORBIDDEN).body("{'reason': 'Remote server responded with: "+responseCode+"'}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
|
||||||
|
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
||||||
}
|
}
|
|
@ -257,6 +257,7 @@ public class Datasets {
|
||||||
try {
|
try {
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class Projects {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
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.security.core.AuthenticationException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import dao.entities.security.UserInfoDao;
|
import dao.entities.UserInfoDao;
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
import exceptions.NonValidTokenException;
|
import exceptions.NonValidTokenException;
|
||||||
import security.validators.GoogleTokenValidator;
|
import security.validators.GoogleTokenValidator;
|
||||||
import security.validators.NativeTokenValidator;
|
import security.validators.NativeTokenValidator;
|
||||||
|
@ -64,7 +64,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||||
else
|
else
|
||||||
throw new AuthenticationServiceException("Authentication failed");
|
throw new AuthenticationServiceException("Authentication failed");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.http.javanet.NetHttpTransport;
|
||||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||||
|
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
import exceptions.NonValidTokenException;
|
import exceptions.NonValidTokenException;
|
||||||
|
|
||||||
public class GoogleTokenValidator implements TokenValidator {
|
public class GoogleTokenValidator implements TokenValidator {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<bean id="nativeTokenValidator" class="security.validators.NativeTokenValidator" />
|
<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}"/>
|
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
||||||
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
||||||
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
<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" />
|
<bean id="userAuthDao" class="dao.entities.security.UserAuthDaoImpl" />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
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:resources mapping="resources/**" location="/resources/" />
|
||||||
<mvc:annotation-driven />
|
<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 />
|
<mvc:annotation-driven />
|
||||||
<context:component-scan base-package="rest" />
|
<context:component-scan base-package="rest" />
|
||||||
|
|
||||||
<bean id="proxy" class="rest.proxy.Proxy">
|
|
||||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean
|
<bean
|
||||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||||
|
|
|
@ -3,7 +3,20 @@
|
||||||
|
|
||||||
<display-name>dmp-backend</display-name>
|
<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>
|
||||||
<servlet-name>dmp-backend-login</servlet-name>
|
<servlet-name>dmp-backend-login</servlet-name>
|
||||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
|
Loading…
Reference in New Issue