【问题标题】:How can i configure oauth2 resourceserver for spring webflux app?如何为 spring webflux 应用程序配置 oauth2 资源服务器?
【发布时间】:2019-02-27 20:45:36
【问题描述】:
【问题讨论】:
标签:
spring-security
spring-security-oauth2
spring-webflux
【解决方案1】:
我不知道它是否真的适用于 RC1,但使用 2.1.0.M1 我可以让它像这样工作:
build.gradle:
repositories {
mavenCentral()
maven {
url 'https://repo.spring.io/libs-snapshot'
}
}
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-gateway:2.1.0.M1'
}
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.security:spring-security-oauth2-jose'
compile 'org.springframework.security:spring-security-oauth2-client'
compile 'org.springframework.security:spring-security-oauth2-resource-server'
}
应用程序.yaml
spring:
security:
oauth2:
resourceserver:
jwt:
jwk-set-uri: http://keycloak.example.com/auth/realms/your-realm/protocol/openid-connect/certs
https://github.com/spring-projects/spring-security/tree/master/samples/boot/oauth2resourceserver-webflux也有一个示例