-
-
Save yamabicodev/1eeb12f187f2d7ce74cb8ac62c3a3341 to your computer and use it in GitHub Desktop.
Spring Security OAuth2 Client Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Configuration | |
| public class OAuth2ClientDemoConfig extends WebSecurityConfigurerAdapter { | |
| @Override | |
| protected void configure(HttpSecurity http) throws Exception { | |
| http.authorizeRequests() | |
| .antMatchers("/").permitAll() | |
| .antMatchers("/css/**").permitAll() | |
| // 独自のログイン画面を表示する場合 | |
| .antMatchers("/login").permitAll() | |
| //上記以外のURLパスがきた場合は認証必須とする設定 | |
| .anyRequest().authenticated() | |
| .and() | |
| .oauth2Login() | |
| // 独自のログイン画面を表示する場合パスを指定する。 | |
| .loginPage("/login"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment