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

noreply at shibboleth.net noreply at shibboleth.net
Tue Feb 4 05:13:18 EST 2014


Author: rdw
Date: Tue Feb  4 05:13:18 2014
New Revision: 5311

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5311&view=rev
Log:
IDP-359 Add SAML1 Direct decoder (so I cna use it in subsequent tests)

Added:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/DirectNameIdentifierDecoder.java   (with props)
Modified:
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DirectDecoderTest.java

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DirectDecoderTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DirectDecoderTest.java?rev=5311&r1=5310&r2=5311&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DirectDecoderTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/DirectDecoderTest.java Tue Feb  4 05:13:18 2014
@@ -23,6 +23,8 @@
 import net.shibboleth.utilities.java.support.component.UninitializedComponentException;
 
 import org.opensaml.profile.ProfileException;
+import org.opensaml.saml.saml1.core.NameIdentifier;
+import org.opensaml.saml.saml1.core.impl.NameIdentifierBuilder;
 import org.opensaml.saml.saml2.core.NameID;
 import org.opensaml.saml.saml2.core.impl.NameIDBuilder;
 import org.testng.Assert;
@@ -54,4 +56,25 @@
         decode.decode(nameId, null, null);
     }
 
+    @Test public void testSAML1Sucess() throws ProfileException, ComponentInitializationException, IOException {
+        DirectNameIdentifierDecoder decode = new DirectNameIdentifierDecoder();
+        decode.setId("Decoder");
+        decode.initialize();
+        
+        NameIdentifier nameIdentifier = new NameIdentifierBuilder().buildObject();
+        nameIdentifier.setNameIdentifier(PRINCIPAL);
+        
+        Assert.assertEquals(decode.decode(nameIdentifier, null, null), PRINCIPAL);
+
+    }
+
+    @Test(expectedExceptions={UninitializedComponentException.class,}) public void testSAML1Noinit() throws ProfileException, ComponentInitializationException, IOException {
+
+        DirectNameIdentifierDecoder decode = new DirectNameIdentifierDecoder();
+        decode.setId("Decoder");
+        NameIdentifier nameIdentifier = new NameIdentifierBuilder().buildObject();
+        nameIdentifier.setNameIdentifier(PRINCIPAL);
+        decode.decode(nameIdentifier, null, null);
+    }
+
 }



More information about the commits mailing list