Commit 7350a86e authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Fixed rest-api and web module

parent d27eb97c
Pipeline #7341 failed with stage
in 125 minutes and 16 seconds
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>rest-api</artifactId>
<name>rest-api</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>rest-api</artifactId>
<name>rest-api</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>service</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>${rs-jax.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>${rs-jax.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-faces</artifactId>
<version>${springframework.webflow.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
......@@ -89,6 +87,6 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
......@@ -2,8 +2,10 @@ package lcsb.mapviewer.api;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"lcsb.mapviewer.api"})
public class SpringRestApiConfig {
}
......
package lcsb.mapviewer.security;
package lcsb.mapviewer.api.users;
import java.util.ArrayList;
......@@ -8,11 +8,13 @@ import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import lcsb.mapviewer.services.interfaces.IUserService;
@Transactional(readOnly = false)
@Service
public class CustomAuthenticationProvider implements AuthenticationProvider {
Logger logger = Logger.getLogger(CustomAuthenticationProvider.class);
......
......@@ -46,15 +46,19 @@ public class UserController extends BaseController {
*/
private Logger logger = Logger.getLogger(UserController.class);
@Autowired
private IUserService userService;
@Autowired
private UserRestImpl userRest;
@Autowired
private AuthenticationProvider authenticationProvider;
@Autowired
public UserController(IUserService userService, UserRestImpl userRest, AuthenticationProvider authenticationProvider) {
this.userService = userService;
this.userRest = userRest;
this.authenticationProvider = authenticationProvider;
}
@RequestMapping(value = "/doLogin", method = { RequestMethod.GET, RequestMethod.POST }, produces = {
MediaType.APPLICATION_JSON_VALUE })
public Map<String, Object> login(
......
......@@ -37,6 +37,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
......@@ -63,6 +64,7 @@ import lcsb.mapviewer.services.interfaces.IUserService;
@Transactional
@Rollback(true)
@ContextConfiguration(classes = SpringRestApiTestConfig.class)
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class RestTestFunctions {
private Logger logger = Logger.getLogger(RestTestFunctions.class);
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import java.io.IOException;
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import java.io.IOException;
import java.io.PrintWriter;
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import java.io.File;
import java.io.IOException;
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import java.io.File;
import java.io.FileInputStream;
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import javax.faces.application.Resource;
import javax.faces.application.ResourceHandler;
......
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
import java.io.IOException;
import java.util.List;
......
/**
* Provides util classes used by the web interface.
*/
package lcsb.mapviewer.bean.utils;
package lcsb.mapviewer.web.bean.utils;
package lcsb.mapviewer.config;
package lcsb.mapviewer.web.config;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
......
package lcsb.mapviewer.config;
package lcsb.mapviewer.web.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"lcsb.mapviewer.api"})
@ComponentScan(basePackages = {"lcsb.mapviewer.web"})
public class SpringWebConfig extends WebMvcConfigurerAdapter {
@Override
......
package lcsb.mapviewer.config;
package lcsb.mapviewer.web.config;
import lcsb.mapviewer.annotation.SpringAnnotationConfig;
import lcsb.mapviewer.api.SpringRestApiConfig;
import lcsb.mapviewer.bean.utils.CssContentTypeFilter;
import lcsb.mapviewer.bean.utils.JsfAjaxAccessControlAllowFilter;
import lcsb.mapviewer.bean.utils.XFrameAccessControlFilter;
import lcsb.mapviewer.web.bean.utils.JsfAjaxAccessControlAllowFilter;
import lcsb.mapviewer.web.bean.utils.XFrameAccessControlFilter;
import lcsb.mapviewer.web.bean.utils.CssContentTypeFilter;
import lcsb.mapviewer.persist.SpringPersistConfig;
import lcsb.mapviewer.services.SpringServiceConfig;
import org.primefaces.webapp.filter.FileUploadFilter;
......
package lcsb.mapviewer.converter;
package lcsb.mapviewer.web.converter;
import java.util.Map;
import java.util.Map.Entry;
......
......@@ -2,5 +2,5 @@
* Provides {@link javax.faces.convert.Converter converters} for components used
* by primefaces.
*/
package lcsb.mapviewer.converter;
package lcsb.mapviewer.web.converter;
package lcsb.mapviewer.events;
package lcsb.mapviewer.web.events;
import java.io.Serializable;
......
package lcsb.mapviewer.events;
package lcsb.mapviewer.web.events;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
......
package lcsb.mapviewer.events;
package lcsb.mapviewer.web.events;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
......
package lcsb.mapviewer.events;
package lcsb.mapviewer.web.events;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
......
/**
* Provides events and listeners functionality.
*/
package lcsb.mapviewer.events;
package lcsb.mapviewer.web.events;
......@@ -2,5 +2,5 @@
* This package contains implementation of Spring interfaces used during
* authentication process.
*/
package lcsb.mapviewer.security;
package lcsb.mapviewer.web.security;
......@@ -10,7 +10,7 @@
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<!-- define custom resource handler for adding svn version to the resource file url-->
<resource-handler>lcsb.mapviewer.bean.utils.VersionResourceHandler</resource-handler>
<resource-handler>lcsb.mapviewer.web.bean.utils.VersionResourceHandler</resource-handler>
</application>
<navigation-rule>
......
......@@ -57,18 +57,18 @@
<constructor-arg name="expiredUrl" value="/index.xhtml" />
</bean>
<bean id="mapViewerUsernamePasswordAuthenticationFilter" class="lcsb.mapviewer.security.MvUsernamePasswordAuthenticationFilter">
<bean id="mapViewerUsernamePasswordAuthenticationFilter" class="lcsb.mapviewer.web.security.MvUsernamePasswordAuthenticationFilter">
<property name="sessionAuthenticationStrategy" ref="sas" />
<property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationFailureHandler" ref="authenticationFailureHandler"/>
<property name="authenticationSuccessHandler" ref="authenticationSuccessHandler"/>
</bean>
<bean id="authenticationSuccessHandler" class="lcsb.mapviewer.security.MvAuthenticationSuccessHandler">
<bean id="authenticationSuccessHandler" class="lcsb.mapviewer.web.security.MvAuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="/login.xhtml"/>
</bean>
<bean id="authenticationFailureHandler" class="lcsb.mapviewer.security.MvAuthenticationFailureHandler">
<bean id="authenticationFailureHandler" class="lcsb.mapviewer.web.security.MvAuthenticationFailureHandler">
<constructor-arg value="/login.xhtml"></constructor-arg>
</bean>
......@@ -94,7 +94,7 @@
<bean id="httpSessionSecurityContextRepository" class="org.springframework.security.web.context.HttpSessionSecurityContextRepository"/>
<bean id="authenticationProvider" class="lcsb.mapviewer.security.CustomAuthenticationProvider">
<bean id="authenticationProvider" class="lcsb.mapviewer.api.users.CustomAuthenticationProvider">
<property name="userService" ref="UserService" />
</bean>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment