cleanup and upgrade

This commit is contained in:
DOHA
2016-01-05 19:55:11 +02:00
parent 4a029959af
commit 6b10b326a2
10 changed files with 42 additions and 76 deletions

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>