Author: anil.saldhana(a)jboss.com
Date: 2008-12-09 14:07:45 -0500 (Tue, 09 Dec 2008)
New Revision: 136
Added:
identity-federation/trunk/identity-fed-api/
identity-federation/trunk/identity-fed-api/.project
identity-federation/trunk/identity-fed-api/pom.xml
identity-federation/trunk/identity-fed-api/src/
identity-federation/trunk/identity-fed-api/src/test/
identity-federation/trunk/identity-fed-api/src/test/java/
identity-federation/trunk/identity-fed-api/src/test/java/org/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnRequestUnitTestCase.java
identity-federation/trunk/identity-fed-api/src/test/resources/
identity-federation/trunk/identity-fed-api/src/test/resources/saml/
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestExample.xml
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestWithSignature.xml
Modified:
identity-federation/trunk/pom.xml
Log:
identity fed api
Added: identity-federation/trunk/identity-fed-api/.project
===================================================================
--- identity-federation/trunk/identity-fed-api/.project (rev 0)
+++ identity-federation/trunk/identity-fed-api/.project 2008-12-09 19:07:45 UTC (rev 136)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>identity-fed-api</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: identity-federation/trunk/identity-fed-api/pom.xml
===================================================================
--- identity-federation/trunk/identity-fed-api/pom.xml (rev 0)
+++ identity-federation/trunk/identity-fed-api/pom.xml 2008-12-09 19:07:45 UTC (rev 136)
@@ -0,0 +1,83 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-fed-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-identity-fed-api</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity Federation Consolidated API</name>
+ <
url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity Federation API contains the API to be used by the
users of JBoss Identity Federation.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <
url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/identi...
+
<
developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/identi...
+
<
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/identity-...
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/**TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+
<argLine>-Djava.endorsed.dirs=${basedir}/src/test/resources/endorsed</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-fed-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaf</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>codehaus-stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>1.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added:
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnRequestUnitTestCase.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnRequestUnitTestCase.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnRequestUnitTestCase.java 2008-12-09
19:07:45 UTC (rev 136)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.api.saml.v2;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.TestCase;
+
+import org.jboss.identity.federation.saml.v2.assertion.AudienceRestrictionType;
+import org.jboss.identity.federation.saml.v2.assertion.ConditionAbstractType;
+import org.jboss.identity.federation.saml.v2.assertion.ConditionsType;
+import org.jboss.identity.federation.saml.v2.assertion.NameIDType;
+import org.jboss.identity.federation.saml.v2.assertion.SubjectType;
+import org.jboss.identity.federation.saml.v2.factories.JBossSAMLAuthnRequestFactory;
+import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
+import org.jboss.identity.federation.saml.v2.protocol.RequestedAuthnContextType;
+import org.jboss.identity.federation.w3.xmldsig.SignatureType;
+
+
+
+/**
+ * Unit test the SAML2 Authn Request Context constructs
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Dec 8, 2008
+ */
+public class SAML2AuthnRequestUnitTestCase extends TestCase
+{
+ /**
+ * Test reading a saml2 authn request
+ * @throws Exception
+ */
+ public void testAuthnRequestExample() throws Exception
+ {
+ String resourceName =
"saml/v2/authnrequest/samlAuthnRequestExample.xml";
+
+ AuthnRequestType authnRequestType =
JBossSAMLAuthnRequestFactory.getAuthnRequestType(resourceName);
+
+
assertEquals("http://www.example.com/",
authnRequestType.getDestination());
+ assertEquals("urn:oasis:names:tc:SAML:2.0:consent:obtained",
authnRequestType.getConsent());
+
assertEquals("http://www.example.com/",authnRequestType.getAsse...;
+ assertEquals(Integer.valueOf("0"),
authnRequestType.getAttributeConsumingServiceIndex());
+
+ SubjectType subjectType = authnRequestType.getSubject();
+ assertNotNull(subjectType);
+
+ List<JAXBElement<?>> subjectContentList = subjectType.getContent();
+ JAXBElement<?> elem1 = subjectContentList.get(0);
+ NameIDType nameIDType = (NameIDType) elem1.getValue();
+
+
assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",nameIDType.getFormat());
+ assertEquals("j.doe(a)company.com",nameIDType.getValue());
+
+ ConditionsType conditionsType = authnRequestType.getConditions();
+ List<ConditionAbstractType> conditions =
conditionsType.getConditionOrAudienceRestrictionOrOneTimeUse();
+ assertTrue(conditions.size() == 1);
+
+ ConditionAbstractType condition = conditions.get(0);
+ assertTrue(condition instanceof AudienceRestrictionType);
+ AudienceRestrictionType audienceRestrictionType = (AudienceRestrictionType)
condition;
+ List<String> audiences = audienceRestrictionType.getAudience();
+ assertTrue(audiences.size() == 1);
+ assertEquals("urn:foo:sp.example.org", audiences.get(0));
+
+ RequestedAuthnContextType requestedAuthnContext =
authnRequestType.getRequestedAuthnContext();
+ assertEquals(
"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
+ ,requestedAuthnContext.getAuthnContextClassRef().get(0));
+ }
+
+ /**
+ * Test reading a saml authn request from a file that
+ * contains a digital signature
+ * @throws Exception
+ */
+ public void testAuthnRequestWithSignature() throws Exception
+ {
+ String resourceName =
"saml/v2/authnrequest/samlAuthnRequestWithSignature.xml";
+
+ AuthnRequestType authnRequestType =
JBossSAMLAuthnRequestFactory.getAuthnRequestType(resourceName);
+ assertNotNull(authnRequestType);
+
+ SignatureType signatureType = authnRequestType.getSignature();
+ assertNotNull("Signature is not null", signatureType);
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestExample.xml
===================================================================
(Binary files differ)
Property changes on:
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestExample.xml
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestWithSignature.xml
===================================================================
---
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestWithSignature.xml
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/test/resources/saml/v2/authnrequest/samlAuthnRequestWithSignature.xml 2008-12-09
19:07:45 UTC (rev 136)
@@ -0,0 +1,68 @@
+<!-- Picked up from
http://wiki.eclipse.org/SAML2_IdP_Overview -->
+<samlp:AuthnRequest
+ AssertionConsumerServiceURL="http://localhost/org.eclipse.higgins.saml2idp.test/SAMLEndpoint"
+ Destination="http://localhost/org.eclipse.higgins.saml2idp.server/SAMLEndpoint"
+ ID="a2sffdlgdhgfg32fdldsdghdsgdgfdglgx"
+ IssueInstant="2007-12-17T18:40:52.203Z"
+ ProtocolBinding="urn:oasis:names.tc:SAML:2.0:bindings:HTTP-Redirect"
+ ProviderName="Test SAML2 SP" Version="2.0"
+ xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
+
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+
+ <Issuer>Test SAML2 SP</Issuer>
+
+ <Signature
xmlns="http://www.w3.org/2000/09/xmldsig#">
+ <SignedInfo>
+ <CanonicalizationMethod
+
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComme...
/>
+ <SignatureMethod
+
Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1" />
+ <Reference URI="#ccocfkmlnocbajegpiheahonbcambbapiibggije">
+ <Transforms>
+ <Transform
+
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+ </Transforms>
+ <DigestMethod
+
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+ <DigestValue>N1Aze93QqDxax3cmBgPmKFNdM8U=</D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4DW
+ B5t62LBoIMMsrdsMVKpzCJmUgnnIY8B4maJe2BYVRBBhISGoBnTKSWxObUg30fIfRlVFFxtTeWq8
+ tPS9u+MI3HuFn0MPVL+TgBw24ufSWPEEUiZU0eDdjzF51/yTVqUCHYNJH7gG7kugrQ8LdKes7rfD
+ c9glkilm1iAcSCfNvqsktKcN+BCOaCdsQhT5yw==
+ </Y>
+ </DSAKeyValue>
+ </KeyValue>
+ </KeyInfo>
+ </Signature>
+
+ <samlp:NameIDPolicy
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
+ AllowCreate="true"
+ />
+
+</samlp:AuthnRequest>
\ No newline at end of file
Modified: identity-federation/trunk/pom.xml
===================================================================
--- identity-federation/trunk/pom.xml 2008-12-09 16:34:46 UTC (rev 135)
+++ identity-federation/trunk/pom.xml 2008-12-09 19:07:45 UTC (rev 136)
@@ -16,6 +16,7 @@
<modules>
<module>parent</module>
<module>identity-fed-model</module>
+ <module>identity-fed-api</module>
<module>identity-samples</module>
<module>identity-bindings</module>
<module>assembly</module>