首页 文章

如何配置Spring Security SAML以与Okta一起使用?

提问于
浏览
7

我正在努力使spring-boot-security-saml-sample应用程序与Okta一起工作 . 要将Okta添加为提供程序,我对WebSecurityConfig.java进行了以下更改:

https://gist.github.com/mraible/c8b52972f76e6f5e30d5

我发现以下问题提供了一些指导,但我无法完成工作 .

configuring saml-sample (SP) to work with Okta (IdP)

这就是我在Okta上使用的值:

Application label: Spring Boot SAML App
Force Authentication: false
Post Back URL: http://localhost:8080/
Name ID Format: EmailAddressRecipient
Recipient: http://localhost:8080/saml/SSO/alias/defaultAlias
Audience Restriction: com:vdenotaris:spring:sp
authnContextClassRef: PasswordProtectedTransport
Response: Signed
Assertion: Signed
Request: Compressed
Destination: http://localhost:8080/saml/SSO/alias/defaultAlias
Default Relay State: (none)
Attribute Statements: email|${user.email},firstName|${user.firstName}

看起来它可以从日志中运行:

[2014-12-30 12:18:33.004] boot - 18748 DEBUG [http-nio-8080-exec-8] --- BaseMessageEncoder: Successfully encoded message.
[2014-12-30 12:18:33.004] boot - 18748 DEBUG [http-nio-8080-exec-8] --- HttpSessionStorage: Storing message a12gf64fh3f35fgh2a8dd1fd0i0dc02 to session C5D010344EF5D022718B12B6D25F1D1E
[2014-12-30 12:18:33.004] boot - 18748  INFO [http-nio-8080-exec-8] --- SAMLDefaultLogger: AuthNRequest;SUCCESS;0:0:0:0:0:0:0:1;com:vdenotaris:spring:sp;http://www.okta.com/k2gpb06TOMYOKAWUSXJM;;;

但是,它会将我重定向到Okta的网站,而不是回到我的网站 .

2 回答

  • 0

    我得到了它的工作!密钥似乎是将请求设置为“未压缩” . 从那里,我删除了“别名/ defaultAlias”,因为这只在您在ExtendedMetadata上设置别名时才起作用 . 我的设置适用于Okta方面:

    Application label: Spring Boot SAML App
    Force Authentication: false
    Post Back URL: http://localhost:8080/saml/SSO
    Name ID Format: EmailAddressRecipient
    Recipient: http://localhost:8080/saml/SSO
    Audience Restriction: com:vdenotaris:spring:sp
    authnContextClassRef: PasswordProtectedTransport
    Response: Signed
    Assertion: Signed
    Request: Uncompressed
    Destination: http://localhost:8080/saml/SSO
    Default Relay State: (none)
    Attribute Statements: email|${user.email},firstName|${user.firstName}
    
  • 4

    马特,

    尝试将“Post Back URL”设置为“localhost:8080 / saml / SSO / alias / defaultAlias” .

    从配置的外观来看,“localhost:8080 / saml / SSO / alias / defaultAlias”是“localhost”上的SAML endpoints ,这是我们发布SAML响应的地方 .

    现在它是“localhost:8080 /” - 您的演示站点可能只是将您重定向回Okta而不是解析SAML响应 .

    你还没有提到你在Okta方面所做的事情来测试它 . 以下是如何操作的说明 - https://support.okta.com/entries/27560008-Using-the-App-Integration-Wizard - 使用我们的应用向导,它在okta端创建正确的SAML IDP endpoints . 您的演示站点需要Okta端的SAML登录URL,以便它知道将SAML请求重定向到的位置 .

    有关SAML的更多信息 - 您可以在我们的开发者网站上查看我们的SAML指南 - http://developer.okta.com/docs/getting_started/saml_guidance.html

    让我知道事情的后续 . 干杯

    斯蒂芬

相关问题