[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSe...

noreply at shibboleth.net noreply at shibboleth.net
Fri Aug 29 17:02:20 EDT 2014


Author: scantor
Date: Fri Aug 29 17:02:19 2014
New Revision: 6486

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6486&view=rev
Log:
IDP-224 - more unit tests

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSessionCreationStrategy.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSessionCreationStrategy.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSessionCreationStrategy.java?rev=6486&r1=6485&r2=6486&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSessionCreationStrategy.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/session/impl/SAML2SPSessionCreationStrategy.java Fri Aug 29 17:02:19 2014
@@ -143,8 +143,6 @@
             expiration = now + sessionLifetime;
         }
         
-        // TODO: fix this to clone the NameID and populate any defaulted qualifiers.
-        
         return new SAML2SPSession(issuer, authCtx.getAuthenticationResult().getAuthenticationFlowId(),
                 now, expiration, result.getFirst().getSubject().getNameID(), result.getSecond().getSessionIndex());
     }

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutTest.java?rev=6486&r1=6485&r2=6486&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutTest.java Fri Aug 29 17:02:19 2014
@@ -43,9 +43,13 @@
 import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import net.shibboleth.utilities.java.support.resolver.ResolverException;
 
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.saml2.core.LogoutRequest;
 import org.opensaml.saml.saml2.core.NameID;
+import org.opensaml.saml.saml2.core.SessionIndex;
 import org.opensaml.saml.saml2.profile.SAML2ObjectSupport;
 import org.opensaml.storage.StorageSerializer;
 import org.springframework.mock.web.MockHttpServletRequest;
@@ -60,6 +64,8 @@
 
 /** {@link ProcessLogout} unit test. */
 public class ProcessLogoutTest extends SessionManagerBaseTestCase {
+
+    private SAMLObjectBuilder<SessionIndex> sessionIndexBuilder;
     
     private RequestContext src;
     
@@ -68,6 +74,10 @@
     private ProcessLogout action;
     
     @BeforeMethod public void setUpAction() throws ComponentInitializationException {
+        sessionIndexBuilder = (SAMLObjectBuilder<SessionIndex>)
+                XMLObjectProviderRegistrySupport.getBuilderFactory().<SessionIndex>getBuilderOrThrow(
+                        SessionIndex.DEFAULT_ELEMENT_NAME);
+
         src = new RequestContextBuilder().buildRequestContext();
         prc = new WebflowRequestContextProfileRequestContextLookup().apply(src);
         
@@ -125,6 +135,34 @@
         Assert.assertNull(prc.getSubcontext(LogoutContext.class));
     }
 
+    @Test public void testBadQualifiers() throws SessionException, ResolverException {
+        final Cookie cookie = createSession("joe");
+
+        final NameID nameId = SAML2ActionTestingSupport.buildNameID("joe");
+        nameId.setSPNameQualifier("affiliation");
+        final NameID nameIdForSession = SAML2ActionTestingSupport.buildNameID("joe");
+        prc.getInboundMessageContext().setMessage(SAML2ActionTestingSupport.buildLogoutRequest(nameId));
+
+        HttpServletRequestResponseContext.loadCurrent(new MockHttpServletRequest(), new MockHttpServletResponse());
+        ((MockHttpServletRequest) HttpServletRequestResponseContext.getRequest()).setCookies(cookie);
+        
+        final long creation = System.currentTimeMillis();
+        final long expiration = creation + 3600 * 60 * 1000;
+        
+        final IdPSession session = sessionManager.resolveSingle(new CriteriaSet(new HttpServletRequestCriterion()));
+        Assert.assertNotNull(session);
+        session.addSPSession(new SAML2SPSession(ActionTestingSupport.INBOUND_MSG_ISSUER, "authn/Password", creation, expiration,
+                nameIdForSession, "index"));
+                
+        final Event event = action.execute(src);
+        ActionTestingSupport.assertProceedEvent(event);
+        Assert.assertNull(prc.getSubcontext(SessionContext.class));
+        Assert.assertNull(prc.getSubcontext(SubjectContext.class));

[... 207 lines stripped ...]


More information about the commits mailing list