[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/saml2/Add...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Jan 9 21:13:57 EST 2014
Author: scantor
Date: Thu Jan 9 21:13:56 2014
New Revision: 5174
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5174&view=rev
Log:
Add SessionIndex / SessionNotOnOrAfter support.
Modified:
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java
Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java?rev=5174&r1=5173&r2=5174&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertion.java Thu Jan 9 21:13:56 2014
@@ -39,6 +39,7 @@
import net.shibboleth.idp.relyingparty.RelyingPartyContext;
import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
import net.shibboleth.idp.saml.authn.principal.AuthnContextDeclRefPrincipal;
+import net.shibboleth.idp.saml.profile.config.saml2.BrowserSSOProfileConfiguration;
import net.shibboleth.idp.saml.profile.saml2.SAML2ActionSupport;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -75,9 +76,12 @@
* The {@link AuthnContext} will be set via {@link RequestedPrincipalContext#getMatchingPrincipal()}, or via an injected
* or defaulted function that obtains a custom principal from the profile context.</p>
*
+ * <p>The SessionIndex and optionally SessionNotOnOrAfter attributes will also be set.</p>
+ *
* @event {@link EventIds#PROCEED_EVENT_ID}
* @event {@link EventIds#INVALID_MSG_CTX}
* @event {@link IdPEventIds#INVALID_RELYING_PARTY_CTX}
+ * @event {@link IdPEventIds#INVALID_PROFILE_CONFIG}
* @event {@link AuthnEventIds#INVALID_AUTHN_CTX}
*/
public class AddAuthnStatementToAssertion extends AbstractAuthenticationAction<Object, Response> {
@@ -186,6 +190,11 @@
if (relyingPartyCtx == null) {
log.debug("{} No relying party context located in current profile request context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
+ return false;
+ } else if (relyingPartyCtx.getProfileConfig() == null
+ || relyingPartyCtx.getProfileConfig().getSecurityConfiguration() == null) {
+ log.debug("{} No profile configuration located in relying party context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_PROFILE_CONFIG);
return false;
}
@@ -273,6 +282,19 @@
authnContext.setAuthnContextClassRef(
classRefLookupStrategy.apply(profileRequestContext).getAuthnContextClassRef());
}
+
+ if (relyingPartyCtx.getProfileConfig() != null &&
+ relyingPartyCtx.getProfileConfig() instanceof BrowserSSOProfileConfiguration) {
+ final BrowserSSOProfileConfiguration profileConfig =
+ (BrowserSSOProfileConfiguration) relyingPartyCtx.getProfileConfig();
+ if (profileConfig.getMaximumSPSessionLifetime() > 0) {
+ statement.setSessionNotOnOrAfter(new DateTime().plus(profileConfig.getMaximumSPSessionLifetime()));
+ }
+ }
+
+ statement.setSessionIndex(
+ relyingPartyCtx.getProfileConfig().getSecurityConfiguration().getIdGenerator().generateIdentifier());
+
return statement;
}
}
Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java?rev=5174&r1=5173&r2=5174&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAuthnStatementToAssertionTest.java Thu Jan 9 21:13:56 2014
@@ -33,7 +33,10 @@
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.idp.profile.RequestContextBuilder;
+import net.shibboleth.idp.profile.config.ProfileConfiguration;
+import net.shibboleth.idp.profile.config.SecurityConfiguration;
import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
+import net.shibboleth.idp.saml.profile.config.saml2.BrowserSSOProfileConfiguration;
[... 40 lines stripped ...]
More information about the commits
mailing list