Я нашел учебник по SSO https://github.com/dsyer/spring-security-angular/tree/master/oauth2 с конфигурацией
oauth2-authserver
@Configuration
@Order(-10)
protected static class LoginConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.formLogin().loginPage("/login").permitAll()
.and()
.requestMatchers().antMatchers("/login", "/oauth/authorize", "/oauth/confirm_access")
.and()
.authorizeRequests().anyRequest().authenticated()
.and().sessionManagement();
// @formatter:on
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.parentAuthenticationManager(authenticationManager);
}
}
oauth2-ui
@Override
public void configure(HttpSecurity http) throws Exception {
http.logout().and().antMatcher("/**").authorizeRequests()
.antMatchers("/index.html", "/home.html", "/", "/login").permitAll()
.anyRequest().authenticated().and().csrf()
.csrfTokenRepository(csrfTokenRepository()).and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
}
Мне нужен мой authserver только для однократной проверки входа в систему, поэтому, когда пользователь уже аутентифицирован и перенаправлен в приложение oauth2-ui, срок аутентификации на сервере истек. Поэтому, когда пользователь выходит из системы oauth2-ui и пытается снова войти в систему, пользователь должен снова ввести имя пользователя и пароль, поскольку срок аутентификации на сервере истек.
Извините за плохой английский, заранее спасибо!