[java-idp-testbed COMMIT] /trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java
noreply at shibboleth.net
noreply at shibboleth.net
Fri Jan 31 15:38:52 EST 2014
Author: tzeller
Date: Fri Jan 31 15:38:52 2014
New Revision: 138
URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=138&view=rev
Log:
IDP-219 : Add AddAttributeStatementToAssertion action to SAML 1 flow.
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=138&r1=137&r2=138&view=diff
==============================================================================
--- trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java (original)
+++ trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java Fri Jan 31 15:38:52 2014
@@ -21,9 +21,12 @@
import javax.annotation.Nonnull;
+import org.opensaml.core.xml.schema.XSString;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.common.SAMLVersion;
import org.opensaml.saml.saml1.core.Assertion;
+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.Response;
import org.opensaml.saml.saml1.core.StatusCode;
@@ -94,6 +97,35 @@
Assert.assertEquals(AuthenticationStatement.UNSPECIFIED_AUTHN_METHOD, authnStatement.getAuthenticationMethod());
// TODO subject locality, etc
+ Assert.assertNotNull(assertion.getAttributeStatements());
+ Assert.assertFalse(assertion.getAttributeStatements().isEmpty());
+ Assert.assertEquals(1, assertion.getAttributeStatements().size());
+ Assert.assertNotNull(assertion.getAttributeStatements().get(0));
+
+ AttributeStatement attributeStatement = assertion.getAttributeStatements().get(0);
+
+ Assert.assertNotNull(attributeStatement.getAttributes());
+ Assert.assertFalse(attributeStatement.getAttributes().isEmpty());
+ Assert.assertEquals(2, attributeStatement.getAttributes().size());
+
+ // TODO attribute ordering ?
+ Attribute eduPersonAffiliation = attributeStatement.getAttributes().get(0);
+ Assert.assertEquals(eduPersonAffiliation.getAttributeName(), "urn:mace:dir:attribute-def:eduPersonAffiliation");
+ Assert.assertEquals(eduPersonAffiliation.getAttributeNamespace(),
+ "urn:mace:shibboleth:1.0:attributeNamespace:uri");
+ // Assert.assertEquals("eduPersonAffiliation", eduPersonAffiliation.);
+ Assert.assertEquals(1, eduPersonAffiliation.getAttributeValues().size());
+ Assert.assertTrue(eduPersonAffiliation.getAttributeValues().get(0) instanceof XSString);
+ Assert.assertEquals("member", ((XSString) eduPersonAffiliation.getAttributeValues().get(0)).getValue());
+
+ Attribute mail = attributeStatement.getAttributes().get(1);
+ Assert.assertEquals(mail.getAttributeName(), "urn:mace:dir:attribute-def:mail");
+ Assert.assertEquals(mail.getAttributeNamespace(), "urn:mace:shibboleth:1.0:attributeNamespace:uri");
+ // Assert.assertEquals("mail", mail.getFriendlyName());
+ Assert.assertEquals(1, mail.getAttributeValues().size());
+ Assert.assertTrue(mail.getAttributeValues().get(0) instanceof XSString);
+ Assert.assertEquals("jdoe at shibboleth.net", ((XSString) mail.getAttributeValues().get(0)).getValue());
+
// TODO meaningful asserts
}
}
More information about the commits
mailing list