@EnableOAuth2Sso // 開啟單點登入功能
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
}
登出
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
// 首頁所有人都可以通路
.antMatchers("/").permitAll()
//其他要認證後才可以通路,如 /member
.anyRequest().authenticated()
.and()
.logout()
//目前應用退出後,會交給某個處理
// 請求認證伺服器将使用者進行退出
.logoutSuccessUrl("http://localhost:7001/auth/logout")
.and()
.csrf().disable()
;
}
