我一直在使用Spring Boot Oauth2教程捣乱,我似乎无法获得一个非常关键的元素:
https://spring.io/guides/tutorials/spring-boot-oauth2/
我想作为授权服务器运行.我尽可能地按照说明进行操作,但是当我进入/ oauth/authorize端点时,我得到的只是403 Forbidden响应.考虑到教程设置的HttpSecurity配置,这实际上对我有意义:
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/login**", "/webjars/**")
.permitAll()
.anyRequest()
.authenticated()
.and().logout().logoutSuccessUrl("/").permitAll()
.and().csrf().csrfTokenRepository(csrfTokenRepository())
.and().addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
.addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
}
Run Code Online (Sandbox Code Playgroud)
本教程的登录页面实际上是主索引,我绝对没有在教程中看到任何指示Oauth系统重定向登录流程的内容.
我可以通过添加以下内容来实现它:
.and().formLogin().loginPage("/")
Run Code Online (Sandbox Code Playgroud)
...但在继续前进之前,我真的很想了解这是教程中的问题还是我对它的实现或其他问题.Oauth安全系统决定"登录"页面的机制是什么?