[java-idp-testbed COMMIT] /trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java

noreply at shibboleth.net noreply at shibboleth.net
Fri Jan 31 18:58:46 EST 2014


Author: tzeller
Date: Fri Jan 31 18:58:46 2014
New Revision: 140

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=140&view=rev
Log:
IDP 219 : Fill in most actions.

Modified:
    trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java

Modified: trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java?rev=140&r1=139&r2=140&view=diff
==============================================================================
--- trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java (original)
+++ trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java Fri Jan 31 18:58:46 2014
@@ -28,6 +28,9 @@
 import org.opensaml.saml.saml1.core.Attribute;
 import org.opensaml.saml.saml1.core.AttributeStatement;
 import org.opensaml.saml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml.saml1.core.Conditions;
+import org.opensaml.saml.saml1.core.ConfirmationMethod;
+import org.opensaml.saml.saml1.core.NameIdentifier;
 import org.opensaml.saml.saml1.core.Response;
 import org.opensaml.saml.saml1.core.StatusCode;
 import org.slf4j.Logger;
@@ -85,47 +88,82 @@
         Assert.assertEquals(assertion.getMinorVersion(), SAMLVersion.VERSION_11.getMinorVersion());
         Assert.assertEquals(assertion.getIssuer(), "https://idp.example.org");
 
-        // TODO assertion conditions ?
+        // TODO are these tests sufficient ?
+        Assert.assertNotNull(assertion.getConditions());
+        Assert.assertNotNull(assertion.getConditions().getNotBefore());
+        Assert.assertNotNull(assertion.getConditions().getNotOnOrAfter());
+
+        Assert.assertNotNull(assertion.getConditions().getAudienceRestrictionConditions());
+        Assert.assertEquals(assertion.getConditions().getAudienceRestrictionConditions().size(), 1);
 
         Assert.assertNotNull(assertion.getAuthenticationStatements());
         Assert.assertFalse(assertion.getAuthenticationStatements().isEmpty());
         Assert.assertEquals(assertion.getAuthenticationStatements().size(), 1);
         Assert.assertNotNull(assertion.getAuthenticationStatements().get(0));
 
-        AuthenticationStatement authnStatement = assertion.getAuthenticationStatements().get(0);
+        AuthenticationStatement authnStmt = assertion.getAuthenticationStatements().get(0);
         // TODO authn method ?
-        Assert.assertEquals(authnStatement.getAuthenticationMethod(), AuthenticationStatement.UNSPECIFIED_AUTHN_METHOD);
+        Assert.assertEquals(authnStmt.getAuthenticationMethod(), AuthenticationStatement.UNSPECIFIED_AUTHN_METHOD);
         // TODO subject locality, etc
+
+        // TODO is this correct ?
+        Assert.assertNotNull(authnStmt.getSubject());
+        Assert.assertNotNull(authnStmt.getSubject().getNameIdentifier());
+        Assert.assertEquals(authnStmt.getSubject().getNameIdentifier().getFormat(), NameIdentifier.EMAIL);
+        Assert.assertEquals(authnStmt.getSubject().getNameIdentifier().getNameIdentifier(), "jdoe at shibboleth.net");
+        Assert.assertEquals(authnStmt.getSubject().getNameIdentifier().getNameQualifier(), "https://idp.example.org");
+
+        // TODO is this correct ?
+        Assert.assertNotNull(authnStmt.getSubject().getSubjectConfirmation());
+        Assert.assertNotNull(authnStmt.getSubject().getSubjectConfirmation().getConfirmationMethods());
+        Assert.assertEquals(authnStmt.getSubject().getSubjectConfirmation().getConfirmationMethods().size(), 1);
+        Assert.assertEquals(authnStmt.getSubject().getSubjectConfirmation().getConfirmationMethods().get(0)
+                .getConfirmationMethod(), ConfirmationMethod.METHOD_BEARER);
 
         Assert.assertNotNull(assertion.getAttributeStatements());
         Assert.assertFalse(assertion.getAttributeStatements().isEmpty());
         Assert.assertEquals(assertion.getAttributeStatements().size(), 1);
         Assert.assertNotNull(assertion.getAttributeStatements().get(0));
 
-        AttributeStatement attributeStatement = assertion.getAttributeStatements().get(0);
+        AttributeStatement attrStmt = assertion.getAttributeStatements().get(0);
 
-        Assert.assertNotNull(attributeStatement.getAttributes());
-        Assert.assertFalse(attributeStatement.getAttributes().isEmpty());
-        Assert.assertEquals(attributeStatement.getAttributes().size(), 2);
+        // TODO is this correct ?
+        Assert.assertNotNull(attrStmt.getSubject());
+        Assert.assertNotNull(attrStmt.getSubject().getNameIdentifier());
+        Assert.assertEquals(attrStmt.getSubject().getNameIdentifier().getFormat(), NameIdentifier.EMAIL);
+        Assert.assertEquals(attrStmt.getSubject().getNameIdentifier().getNameIdentifier(), "jdoe at shibboleth.net");
+        Assert.assertEquals(attrStmt.getSubject().getNameIdentifier().getNameQualifier(), "https://idp.example.org");
+
+        // TODO is this correct ?
+        Assert.assertNotNull(attrStmt.getSubject().getSubjectConfirmation());

[... 48 lines stripped ...]


More information about the commits mailing list