spring webflux安全资源服务器多租户-按rest路径颁发者

tpxzln5u  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(260)

我正在使用webflux安全性实现多租户资源服务器。
这是我当前的配置:

@Bean
    fun securityConfig(http: ServerHttpSecurity): SecurityWebFilterChain? {
        http.authorizeExchange()
            .pathMatchers("/path1", "/path2").authenticated()
            .and()
            .oauth2ResourceServer { rs ->
                rs.authenticationManagerResolver(
                    JwtIssuerReactiveAuthenticationManagerResolver(
                        "http://localhost:8081/auth/realms/realm1",
                        "http://localhost:8082/auth/realms/realm2"
                    )
                )
            }
        return http.build()
    }

这是可行的,我已经用受信任的发布者1或受信任的发布者2保护了/path1和/path2。这允许我使用oauth2发行者调用path1,但这不是我想要的。
我需要用onlytrust_issuer1保护/path1,用onlytrust_issuer2保护/path2,我不确定如何实现这一点,有什么提示吗?
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题