【发布时间】:2020-09-06 00:43:25
【问题描述】:
在我的 Spring Boot 应用程序中,我的用户由第三方进行身份验证,我收到一个 Jwt,我使用 Spring Security 中的 NimbusJwtDecoder 对其进行解析。
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.mvcMatchers("/api/private").authenticated()
.mvcMatchers("/api/organisations").authenticated()
.mvcMatchers("/api/project").authenticated()
.mvcMatchers("/api/user").authenticated()
.and()
.oauth2ResourceServer().jwt();
}
这很好,现在我想通过检索我将存储在我自己的数据库中的角色和权限来添加授权。我有来自 Jwt 的用户名,但我不知道如何将其全部插入。任何帮助将不胜感激。
【问题讨论】:
标签: spring-security oauth jwt authorization auth0