cleanup and upgrade

This commit is contained in:
DOHA 2016-01-05 19:55:11 +02:00 committed by David Morley
parent 50c1734754
commit a225891456
10 changed files with 42 additions and 76 deletions

View File

@ -128,7 +128,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
@ -164,7 +163,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -174,7 +172,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
@ -183,7 +180,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<!-- <exclude>**/*ProductionTest.java</exclude> -->

View File

@ -31,7 +31,7 @@
<dependency>
<groupId>io.katharsis</groupId>
<artifactId>katharsis-servlet</artifactId>
<version>1.0.0</version>
<version>${katharsis.version}</version>
</dependency>
<!-- test -->
@ -45,7 +45,7 @@
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
<version>${restassured.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
@ -60,6 +60,8 @@
<properties>
<java.version>1.8</java.version>
<katharsis.version>1.0.0</katharsis.version>
<restassured.version>2.4.0</restassured.version>
</properties>

View File

@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<version>1.3.1.RELEASE</version>
</parent>
<dependencies>
@ -39,7 +39,7 @@
<!-- Is the ApacheDS server - 1.5.6 and 1.5.7 don't work -->
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-jndi</artifactId>
<version>1.5.5</version>
<version>${apacheds.version}</version>
</dependency>
</dependencies>
@ -68,42 +68,8 @@
</build>
<properties>
<!-- Spring -->
<org.springframework.version>4.2.4.RELEASE</org.springframework.version>
<org.springframework.security.version>4.0.3.RELEASE</org.springframework.security.version>
<!-- persistence -->
<hibernate.version>4.3.11.Final</hibernate.version>
<mysql-connector-java.version>5.1.37</mysql-connector-java.version>
<!-- logging -->
<org.slf4j.version>1.7.13</org.slf4j.version>
<logback.version>1.1.3</logback.version>
<!-- various -->
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
<!-- util -->
<guava.version>19.0</guava.version>
<commons-lang3.version>3.4</commons-lang3.version>
<!-- testing -->
<org.hamcrest.version>1.3</org.hamcrest.version>
<junit.version>4.12</junit.version>
<mockito.version>1.10.19</mockito.version>
<httpcore.version>4.4.1</httpcore.version>
<httpclient.version>4.5</httpclient.version>
<rest-assured.version>2.4.1</rest-assured.version>
<!-- Maven plugins -->
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<cargo-maven2-plugin.version>1.4.15</cargo-maven2-plugin.version>
<properties>
<apacheds.version>1.5.5</apacheds.version>
</properties>
</project>

View File

@ -9,7 +9,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
* Security Configuration - LDAP and HTTP Authorizations.
*/
@Configuration
// @ImportResource({ "classpath:webSecurityConfig.xml" })
// @ImportResource({ "classpath:webSecurityConfig.xml" }) //=> uncomment to use equivalent xml config
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
@ -20,7 +20,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/", "/home").permitAll().anyRequest().authenticated();
http.formLogin().loginPage("/login").permitAll().loginProcessingUrl("/j_spring_security_check").and().logout().logoutSuccessUrl("/");
http.formLogin().loginPage("/login").permitAll().and().logout().logoutSuccessUrl("/");
}
}

View File

@ -21,7 +21,7 @@
<p th:if="${param.logout}" class="alert">You have been logged out</p>
<p th:if="${param.error}" class="alert alert-error">There was an error, please try again</p>
<h2>Login with Username and Password</h2>
<form name="form" th:action="@{/j_spring_security_check}" action="/login" method="POST">
<form name="form" th:action="@{/login}" method="POST">
<fieldset>
<input type="text" name="username" value="" placeholder="Username" />
<input type="password" name="password" placeholder="Password" />

View File

@ -13,10 +13,7 @@
<intercept-url pattern="/login" access="permitAll"/>
<intercept-url pattern="/secure" access="isAuthenticated()"/>
<form-login login-page='/login' default-target-url="/"
authentication-failure-url="/login?error"
username-parameter="username"
password-parameter="password"/>
<form-login login-page='/login' default-target-url="/" authentication-failure-url="/login?error" />
<logout logout-success-url="/" />
</http>

View File

@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
<version>1.3.1.RELEASE</version>
</parent>
<dependencies>
@ -113,12 +113,12 @@
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>3.6.2</version>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>3.6.2</version>
<version>${querydsl.version}</version>
</dependency>
<!-- Rsql -->
@ -126,7 +126,7 @@
<dependency>
<groupId>cz.jirutka.rsql</groupId>
<artifactId>rsql-parser</artifactId>
<version>2.0.0</version>
<version>${rsql.version}</version>
</dependency>
<!-- web -->
@ -144,7 +144,6 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<!-- persistence -->
@ -164,7 +163,7 @@
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<version>${xml-apis.version}</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
@ -200,7 +199,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.8</version>
<version>${xstream.version}</version>
</dependency>
<!-- util -->
@ -243,7 +242,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
@ -267,7 +265,7 @@
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
<version>${rest-assured.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
@ -344,7 +342,7 @@
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<version>${apt-maven-plugin.version}</version>
<executions>
<execution>
<goals>
@ -434,9 +432,12 @@
<mysql-connector-java.version>5.1.37</mysql-connector-java.version>
<spring-data-jpa.version>1.7.2.RELEASE</spring-data-jpa.version>
<rsql.version>2.0.0</rsql.version>
<querydsl.version>3.6.2</querydsl.version>
<!-- marshalling -->
<jackson.version>2.5.5</jackson.version>
<xml-apis.version>1.4.01</xml-apis.version>
<!-- logging -->
<org.slf4j.version>1.7.13</org.slf4j.version>
@ -444,6 +445,7 @@
<!-- various -->
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
<xstream.version>1.4.8</xstream.version>
<!-- util -->
<guava.version>19.0</guava.version>
@ -464,7 +466,7 @@
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<cargo-maven2-plugin.version>1.4.15</cargo-maven2-plugin.version>
<apt-maven-plugin.version>1.1.3</apt-maven-plugin.version>
</properties>
</project>

View File

@ -82,14 +82,14 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<version>${javax.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<version>${jstl.version}</version>
<scope>runtime</scope>
</dependency>
@ -98,7 +98,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.2</version>
<version>${jackson.version}</version>
</dependency>
<!-- util -->
@ -111,7 +111,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
<version>${commons-lang3.version}</version>
</dependency>
<!-- logging -->
@ -171,13 +171,13 @@
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.2.2</version>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.2.2</version>
<version>${springfox.version}</version>
</dependency>
</dependencies>
@ -263,7 +263,11 @@
<!-- various -->
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
<javax.servlet-api.version>3.0.1</javax.servlet-api.version>
<jstl.version>1.2</jstl.version>
<jackson.version>2.2.2</jackson.version>
<springfox.version>2.2.2</springfox.version>
<!-- util -->
<guava.version>19.0</guava.version>
<commons-lang3.version>3.4</commons-lang3.version>

View File

@ -35,19 +35,16 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
}
@Override
protected void configure(final HttpSecurity http) throws Exception { // @formatter:off
protected void configure(final HttpSecurity http) throws Exception {// @formatter:off
http
.csrf().disable()
.exceptionHandling()
.authenticationEntryPoint(restAuthenticationEntryPoint)
.and()
.authorizeRequests()
.antMatchers("/api/foos").authenticated()
.antMatchers("/api/**").authenticated()
.and()
.formLogin()
.loginProcessingUrl("/j_spring_security_check")
.usernameParameter("j_username")
.passwordParameter("j_password")
.successHandler(authenticationSuccessHandler)
.failureHandler(new SimpleUrlAuthenticationFailureHandler())
.and()

View File

@ -11,7 +11,9 @@
<http use-expressions="true" entry-point-ref="restAuthenticationEntryPoint">
<intercept-url pattern="/api/**" access="isAuthenticated()"/>
<sec:form-login authentication-success-handler-ref="mySuccessHandler" authentication-failure-handler-ref="myFailureHandler"/>
<csrf disabled="true"/>
<form-login authentication-success-handler-ref="mySuccessHandler" authentication-failure-handler-ref="myFailureHandler"/>
<logout/>
</http>