spring-boot - Spring 启动 oauth2 : How to set the resource parameter in the authorization request to make adfs happy?

标签 spring-boot spring-security-oauth2 adfs3.0

我正在尝试设置一个 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/

相关文章:

spring-boot - 在weblogic服务器中部署spring boot应用程序时如何解决javax.validation的NoSuchMethodError?

java - 数据库变更和 Spring Boot JPA

c# - 创建 WCF Rest 服务以接受 SAML 并对 Windows 用户进行身份验证

oauth-2.0 - ADFS 3.0 的 OAuth 注销端点

java - 使用 Spring Security 5 在 Issuer Resolver 之后从 Bearer Token 中提取身份验证

c#-4.0 - 在 IDP 启动的 Web SSO 中使用 C# 和 .NET 4.5 创建 SAML 2.0 响应

java - @ElementCollection 至少包含一个元素,最多包含 N 个元素

java - 在 Spring Boot 的同一个 pom.xml 中管理 H2 和 Postgres

java - Spring Boot 安全 Rest API

api - 使用 Spring Boot 和 OAuth2 获取此资源的范围不足