* minor logging fix

* spring security sso

* use basic auth

* use form login

* cleanup

* cleanup

* final cleanup

* second client app for sso

* spring boot bootstrap

* add logic

* cleanup

* add simple controller

* add thymeleaf and security

* minor fix

* minor fix

* add more boot properties

* fix live test

* fix live test

* minor fix

* semaphores

* fix configuration

* kotlin collection

* add more collection examples

* minor upgrade

* cucumber java8

* minor fix
This commit is contained in:
Doha2012 2017-07-30 09:08:54 +02:00 committed by Eugen
parent 4441d969fa
commit 610bb05123
1 changed files with 16 additions and 21 deletions

View File

@ -1,17 +1,14 @@
package org.baeldung.spring; package org.baeldung.spring;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
@Configuration //@Configuration
//@ImportResource({ "classpath:RedirectionWebSecurityConfig.xml" }) //@ImportResource({ "classpath:RedirectionWebSecurityConfig.xml" })
@EnableWebSecurity //@EnableWebSecurity
@Profile("!https") //@Profile("!https")
public class RedirectionSecurityConfig extends WebSecurityConfigurerAdapter { public class RedirectionSecurityConfig extends WebSecurityConfigurerAdapter {
public RedirectionSecurityConfig() { public RedirectionSecurityConfig() {
@ -20,25 +17,23 @@ public class RedirectionSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception { protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth auth.inMemoryAuthentication()
.inMemoryAuthentication() .withUser("user1")
.withUser("user1") .password("user1Pass")
.password("user1Pass") .roles("USER");
.roles("USER");
} }
@Override @Override
protected void configure(final HttpSecurity http) throws Exception { protected void configure(final HttpSecurity http) throws Exception {
http http.authorizeRequests()
.authorizeRequests() .antMatchers("/login*")
.antMatchers("/login*") .permitAll()
.permitAll() .anyRequest()
.anyRequest() .authenticated()
.authenticated() .and()
.and() .formLogin()
.formLogin() .successHandler(new SavedRequestAwareAuthenticationSuccessHandler());
.successHandler(new SavedRequestAwareAuthenticationSuccessHandler()); // .successHandler(new RefererAuthenticationSuccessHandler())
//.successHandler(new RefererAuthenticationSuccessHandler())
} }
} }