我正在尝试设置一个 spring boot 应用程序,它使用 oauth2 和 Active Directory 联合身份验证服务作为身份验证提供程序。我从这里的教程开始...
https://spring.io/guides/tutorials/spring-boot-oauth2/
... 并让 facebook 示例开始工作。然后,我开始调整它以使用 ADFS。它快要工作了,但 ADFS 期望资源参数随授权请求一起传递,我不知道如何设置它。这是我目前在配置中得到的...
security:
oauth2:
client:
clientId: spring-boot-test-client
userAuthorizationUri: https://domain/adfs/oauth2/authorize
access-token-uri: https://domain/adfs/oauth2/token
tokenName: code
authenticationScheme: query
clientAuthenticationScheme: form
grant-type: authorization_code
当我点击登录链接时,它重定向到 https://domain/adfs/oauth2/authorize?client_id=spring-boot-test-client&redirect_uri=http://localhost:8080/login&response_type=code&state=rjzfyZ
我试过设置 security:oauth2:client:id、security:oauth2:client:resourceids 和 security:oauth2:resource:id,但这些似乎都不影响第一次重定向。知道我应该设置什么来获取第一个重定向中包含的资源吗?
最佳答案
在这里回答我自己的问题...这可能是一个 hack,但我只是将资源附加到 userAuthorizationUri
security:
oauth2:
client:
clientId: spring-boot-test-client
userAuthorizationUri: https://domain/adfs/oauth2/authorize?resource=RelyingPartyTrustIdentifier
access-token-uri: https://domain/adfs/oauth2/token
tokenName: code
authenticationScheme: query
clientAuthenticationScheme: form
grant-type: authorization_code
现在,我正在获取登录表单。
关于spring-boot - Spring 启动 oauth2 : How to set the resource parameter in the authorization request to make adfs happy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39055971/