【发布时间】:2020-03-28 09:45:46
【问题描述】:
我有一个由 spring security 和 spring security oauth2 客户端保护的后端服务器。
@EnableWebSecurity
public class OAuth2ClientSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated()
.and()
.oauth2Login();
}
}
当我访问 localhost:8080/api/get/{id} 在 cookie 中使用 JSessionId 时,这工作正常。
但我想使用基于令牌的身份验证,以便我的 Angular 应用程序可以访问我的后端。我该怎么办?
登录后如何获取令牌而不是 cookie?
请给我一些建议,提前谢谢你。
【问题讨论】:
标签: angular spring spring-security oauth-2.0