rak*_*pan 12 spring spring-security saml-2.0 spring-saml
我们使用ADFS作为IDP,我们的应用程序充当SP.以下是Auth响应示例
<?xml version="1.0" encoding="UTF-8"?>
<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="_82062d3d-897f-473e-90ad-0bb351d63b22" IssueInstant="2015-04-29T20:39:17.240Z" Version="2.0">
<Issuer>http://adfs/services/trust</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#_82062d3d-897f-473e-90ad-0bb351d63b22">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue />
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>certificate..... </ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:Signature>
<Subject>
<NameID>username</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData InResponseTo="923ki0eg8h7g7y2243fi9jbdd1977j9" NotOnOrAfter="2015-04-29T20:44:17.240Z" Recipient="https://localhost/saml/SSO" />
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2015-04-29T20:39:17.240Z" NotOnOrAfter="2015-04-29T21:39:17.240Z">
<AudienceRestriction>
<Audience>https://localhost/saml/metadata</Audience>
</AudienceRestriction>
</Conditions>
<AuthnStatement AuthnInstant="2015-04-29T20:39:17.162Z" SessionIndex="_92062g3d-897f-473e-90ad-0aa351d63b22">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
Run Code Online (Sandbox Code Playgroud)
我面临的问题可分为两种情况:
闲置1小时后,我在本地注销用户.服务器会话到期是默认值30分钟.如果用户正在积极处理某些事情,我有我的代码每隔10分钟发送一次心跳ping.现在,问题是当用户在会话到期1小时后尝试登录时,我得到以下异常
Caused by: org.springframework.security.authentication.CredentialsExpiredException: Authentication statement is too old to be used with value 2015-05-28T17:41:52.648Z
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAuthenticationStatement(WebSSOProfileConsumerImpl.java:538)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertion(WebSSOProfileConsumerImpl.java:306)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:214)
... 77 more
Run Code Online (Sandbox Code Playgroud)这里的问题是..为什么我们的应用程序会尝试验证令牌何时发出的实例?它可以随时授予..
我不断收到SAMLException的消息"本地实体不是至少一个AudienceRestriction中断言的目标读者".跟踪如下
Caused by: org.opensaml.common.SAMLException: Local entity is not the intended audience of the assertion in at least one AudienceRestriction
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAudience(WebSSOProfileConsumerImpl.java:506)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertionConditions(WebSSOProfileConsumerImpl.java:458)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertion(WebSSOProfileConsumerImpl.java:303)
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:214)
... 77 more
Run Code Online (Sandbox Code Playgroud)我不明白为什么会发生这种异常.
请帮我理解这个概念.
谢谢!
Vla*_*fer 29
您的IDP正在重新使用用户之前已经过身份验证的信息(在Authentication Instant标识的时间),默认情况下,Spring SAML配置为如果她在7200秒前进行了身份验证,则不允许用户登录.
这是一种安全措施 - 如果很久以前由于计算机已经对用户进行了身份验证,那么很难保证它仍然是操作计算机的人.Spring SAML为您提供了一些方法来配置可接受的安全级别 - 例如,通过使其可配置.
您可以通过maxAuthenticationAge在WebSSOProfileConsumerImplbean 上设置属性来增加此值.
仅当断言包含Audience元素且其中没有一个与应用程序的实体ID匹配时,才会发生受众错误.我不认为您的问题中的响应是触发此错误的响应吗?
| 归档时间: |
|
| 查看次数: |
10193 次 |
| 最近记录: |