如何确定用户已配置的OAuth2ResourceServer流

问题描述

我正在通过springboot(2.3.3.RELEASE)构建包装器框架。客户端可以根据以下内容配置OAuth2资源服务器以验证JWT或Opaque令牌:

@SpringBootApplication
@EnableGlobalMethodSecurity(prePostEnabled = true,securedEnabled = true)
public class ResourceServerExampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(ResourceServerExampleApplication.class,args);
    }

    @Configuration
    static class SampleOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests()
                .anyRequest().authenticated();
//            .and()
//                .oauth2ResourceServer().jwt();
//                .oauth2ResourceServer().opaqueToken();

           ...
        }

从包装应用程序框架内部,如何确定用户上面配置的内容?我的意思是,我想以编程方式检测用户是否配置了JWTOpaque Token流,并根据此流执行不同的操作。我查看了Spring代码,发现类org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer用于在运行时配置JwtConfigurerOpaqueTokenConfigurer

不幸的是,该类被标记为final,我无法对其进行扩展和自定义。关于如何处理我的要求的任何指示?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...