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

How do I configure Spring Security SAML to work with Okta?

我正在尝试使Okta可以使用spring-boot-security-saml-sample应用程序。 要将Okta添加为提供程序,我对WebSecurityConfig.java进行了以下更改:

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

我发现以下问题提供了一些指导,但我无法完全解决问题。

配置saml-sample(SP)以与Okta(IdP)一起使用

这是我在Okta上用于值的内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
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}

看起来它可以通过日志进行工作:

1
2
3
[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的站点,而不是重定向到我的站点。


我知道了!密钥似乎是将"请求"设置为"未压缩"。从那里,我删除了" alias / defaultAlias",因为这仅在您在ExtendedMetadata上设置别名时才起作用。我在Okta一侧可以使用的设置:

1
2
3
4
5
6
7
8
9
10
11
12
13
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}


马特

尝试将"回发URL"设置为" localhost:8080 / saml / SSO / alias / defaultAlias"。

从配置的外观来看," localhost:8080 / saml / SSO / alias / defaultAlias"是" localhost"上的SAML端点,这是我们向其发布SAML响应的位置。

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

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

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

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

史提芬