无效令牌不包含资源 ID (oauth2_application)

时间:2021-02-02 14:09:32

标签: java spring oauth-2.0

以下是我对 oauth2 的配置,当我尝试转到某个页面时,我被重定向以执行身份验证。 开始认证后,我收到消息:

<块引用>

无效令牌不包含资源 ID (oauth2_application)

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    private String[] swaggerPathPatterns() {
        return new String[]{
                "/v2/api-docs",
                "/configuration/ui",
                "/swagger-resources/**",
                "/configuration/security",
                "/swagger-ui.html",
                "/webjars/**"
        };
    }


    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
                .authorizeRequests(a -> a
                        .antMatchers("/status/**", "/actuator/**").hasRole("USER")
                        .antMatchers(swaggerPathPatterns()).hasRole("USER")
                        .anyRequest().authenticated()
                )
                .oauth2Login();
        // @formatter:on
    }
}

应用属性:

spring.security.oauth2.client.registration.bv-auth.authorization-grant-type=......
spring.security.oauth2.client.registration.bv-auth.client-id=.....
spring.security.oauth2.client.registration.bv-auth.client-name=.....
spring.security.oauth2.client.registration.bv-auth.client-secret=.....
spring.security.oauth2.client.registration.bv-auth.redirect-uri=.....
spring.security.oauth2.client.registration.bv-auth.scope=.....

spring.security.oauth2.client.provider.bv-auth.authorization-uri=.....
spring.security.oauth2.client.provider.bv-auth.jwk-set-uri=.....
spring.security.oauth2.client.provider.bv-auth.token-uri=.....
spring.security.oauth2.client.provider.bv-auth.user-info-uri=.....
spring.security.oauth2.client.provider.bv-auth.user-name-attribute=.....

spring.security.oauth2.resourceserver.jwt.jwk-set-uri=.....

任何帮助将不胜感激。

0 个答案:

没有答案