minor fix (#2334)
* 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:
parent
4441d969fa
commit
610bb05123
|
@ -1,17 +1,14 @@
|
|||
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.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.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
|
||||
@Configuration
|
||||
//@Configuration
|
||||
//@ImportResource({ "classpath:RedirectionWebSecurityConfig.xml" })
|
||||
@EnableWebSecurity
|
||||
@Profile("!https")
|
||||
//@EnableWebSecurity
|
||||
//@Profile("!https")
|
||||
public class RedirectionSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
public RedirectionSecurityConfig() {
|
||||
|
@ -20,25 +17,23 @@ public class RedirectionSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
|
||||
@Override
|
||||
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth
|
||||
.inMemoryAuthentication()
|
||||
.withUser("user1")
|
||||
.password("user1Pass")
|
||||
.roles("USER");
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("user1")
|
||||
.password("user1Pass")
|
||||
.roles("USER");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(final HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.antMatchers("/login*")
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
.and()
|
||||
.formLogin()
|
||||
.successHandler(new SavedRequestAwareAuthenticationSuccessHandler());
|
||||
//.successHandler(new RefererAuthenticationSuccessHandler())
|
||||
http.authorizeRequests()
|
||||
.antMatchers("/login*")
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
.and()
|
||||
.formLogin()
|
||||
.successHandler(new SavedRequestAwareAuthenticationSuccessHandler());
|
||||
// .successHandler(new RefererAuthenticationSuccessHandler())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue