|
@@ -15,15 +15,10 @@
|
|
*/
|
|
*/
|
|
package sample.config;
|
|
package sample.config;
|
|
|
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
|
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.builders.WebSecurity;
|
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
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.core.userdetails.User;
|
|
|
|
-import org.springframework.security.core.userdetails.UserDetails;
|
|
|
|
-import org.springframework.security.core.userdetails.UserDetailsService;
|
|
|
|
-import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author Joe Grandja
|
|
* @author Joe Grandja
|
|
@@ -46,26 +41,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
http
|
|
http
|
|
.authorizeRequests()
|
|
.authorizeRequests()
|
|
- .anyRequest().authenticated()
|
|
|
|
- .and()
|
|
|
|
- .formLogin()
|
|
|
|
- .loginPage("/login")
|
|
|
|
- .failureUrl("/login-error")
|
|
|
|
- .permitAll()
|
|
|
|
|
|
+ .anyRequest().permitAll()
|
|
.and()
|
|
.and()
|
|
|
|
+ .logout()
|
|
|
|
+ .disable()
|
|
.oauth2Client();
|
|
.oauth2Client();
|
|
}
|
|
}
|
|
// @formatter:on
|
|
// @formatter:on
|
|
-
|
|
|
|
- // @formatter:off
|
|
|
|
- @Bean
|
|
|
|
- public UserDetailsService users() {
|
|
|
|
- UserDetails user = User.withDefaultPasswordEncoder()
|
|
|
|
- .username("user1")
|
|
|
|
- .password("password")
|
|
|
|
- .roles("USER")
|
|
|
|
- .build();
|
|
|
|
- return new InMemoryUserDetailsManager(user);
|
|
|
|
- }
|
|
|
|
- // @formatter:on
|
|
|
|
}
|
|
}
|