JBoss Identity SVN: r184 - in identity-federation/trunk: identity-xmlsecmodel/src/main/java and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-01-05 16:07:18 -0500 (Mon, 05 Jan 2009)
New Revision: 184
Added:
identity-federation/trunk/identity-xmlsecmodel/src/main/java/w3/
Removed:
identity-federation/trunk/identity-fed-model/src/main/java/org/jboss/identity/federation/w3/
Log:
refactor w3c sec
Copied: identity-federation/trunk/identity-xmlsecmodel/src/main/java/w3 (from rev 183, identity-federation/trunk/identity-fed-model/src/main/java/org/jboss/identity/federation/w3)
15 years, 4 months
JBoss Identity SVN: r183 - in identity-federation/trunk: identity-xmlsecmodel and 7 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-01-05 16:06:01 -0500 (Mon, 05 Jan 2009)
New Revision: 183
Added:
identity-federation/trunk/identity-xmlsecmodel/
identity-federation/trunk/identity-xmlsecmodel/.classpath
identity-federation/trunk/identity-xmlsecmodel/.project
identity-federation/trunk/identity-xmlsecmodel/pom.xml
identity-federation/trunk/identity-xmlsecmodel/src/
identity-federation/trunk/identity-xmlsecmodel/src/main/
identity-federation/trunk/identity-xmlsecmodel/src/main/java/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmldsig/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmldsig/xmldsig-core-schema.xsd
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmlenc/
identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmlenc/xenc-schema.xsd
Log:
add a new module for xml security model
Added: identity-federation/trunk/identity-xmlsecmodel/.classpath
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/.classpath (rev 0)
+++ identity-federation/trunk/identity-xmlsecmodel/.classpath 2009-01-05 21:06:01 UTC (rev 183)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target-eclipse"/>
+</classpath>
Added: identity-federation/trunk/identity-xmlsecmodel/.project
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/.project (rev 0)
+++ identity-federation/trunk/identity-xmlsecmodel/.project 2009-01-05 21:06:01 UTC (rev 183)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>identity-xmlsec-model</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-xmlsecmodel/pom.xml
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/pom.xml (rev 0)
+++ identity-federation/trunk/identity-xmlsecmodel/pom.xml 2009-01-05 21:06:01 UTC (rev 183)
@@ -0,0 +1,82 @@
+<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-xmlsec-model</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity Federation XML Security Model</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity Federation XML Security Model contains the JAXB2 model for W3C XML Signature and XML Encryption specifications.</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/identity-federation/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/identity-federation/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/identity-federat...</url>
+ </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>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </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-xmlsecmodel/src/main/resources/schema/w3c/xmldsig/xmldsig-core-schema.xsd
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmldsig/xmldsig-core-schema.xsd (rev 0)
+++ identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmldsig/xmldsig-core-schema.xsd 2009-01-05 21:06:01 UTC (rev 183)
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE schema
+ PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"
+ [
+ <!ATTLIST schema
+ xmlns:ds CDATA #FIXED "http://www.w3.org/2000/09/xmldsig#">
+ <!ENTITY dsig 'http://www.w3.org/2000/09/xmldsig#'>
+ <!ENTITY % p ''>
+ <!ENTITY % s ''>
+ ]>
+
+<!-- Schema for XML Signatures
+ http://www.w3.org/2000/09/xmldsig#
+ $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
+
+ Copyright 2001 The Internet Society and W3C (Massachusetts Institute
+ of Technology, Institut National de Recherche en Informatique et en
+ Automatique, Keio University). All Rights Reserved.
+ http://www.w3.org/Consortium/Legal/
+
+ This document is governed by the W3C Software License [1] as described
+ in the FAQ [2].
+
+ [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
+ [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+ targetNamespace="http://www.w3.org/2000/09/xmldsig#"
+ version="0.1" elementFormDefault="qualified">
+
+<!-- Basic Types Defined for Signatures -->
+
+<simpleType name="CryptoBinary">
+ <restriction base="base64Binary">
+ </restriction>
+</simpleType>
+
+<!-- Start Signature -->
+
+<element name="Signature" type="ds:SignatureType"/>
+<complexType name="SignatureType">
+ <sequence>
+ <element ref="ds:SignedInfo"/>
+ <element ref="ds:SignatureValue"/>
+ <element ref="ds:KeyInfo" minOccurs="0"/>
+ <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureValue" type="ds:SignatureValueType"/>
+ <complexType name="SignatureValueType">
+ <simpleContent>
+ <extension base="base64Binary">
+ <attribute name="Id" type="ID" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+<!-- Start SignedInfo -->
+
+<element name="SignedInfo" type="ds:SignedInfoType"/>
+<complexType name="SignedInfoType">
+ <sequence>
+ <element ref="ds:CanonicalizationMethod"/>
+ <element ref="ds:SignatureMethod"/>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
+ <complexType name="CanonicalizationMethodType" mixed="true">
+ <sequence>
+ <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+ <element name="SignatureMethod" type="ds:SignatureMethodType"/>
+ <complexType name="SignatureMethodType" mixed="true">
+ <sequence>
+ <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
+ <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) external namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- Start Reference -->
+
+<element name="Reference" type="ds:ReferenceType"/>
+<complexType name="ReferenceType">
+ <sequence>
+ <element ref="ds:Transforms" minOccurs="0"/>
+ <element ref="ds:DigestMethod"/>
+ <element ref="ds:DigestValue"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="URI" type="anyURI" use="optional"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+</complexType>
+
+ <element name="Transforms" type="ds:TransformsType"/>
+ <complexType name="TransformsType">
+ <sequence>
+ <element ref="ds:Transform" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="Transform" type="ds:TransformType"/>
+ <complexType name="TransformType" mixed="true">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ <element name="XPath" type="string"/>
+ </choice>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- End Reference -->
+
+<element name="DigestMethod" type="ds:DigestMethodType"/>
+<complexType name="DigestMethodType" mixed="true">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+</complexType>
+
+<element name="DigestValue" type="ds:DigestValueType"/>
+<simpleType name="DigestValueType">
+ <restriction base="base64Binary"/>
+</simpleType>
+
+<!-- End SignedInfo -->
+
+<!-- Start KeyInfo -->
+
+<element name="KeyInfo" type="ds:KeyInfoType"/>
+<complexType name="KeyInfoType" mixed="true">
+ <choice maxOccurs="unbounded">
+ <element ref="ds:KeyName"/>
+ <element ref="ds:KeyValue"/>
+ <element ref="ds:RetrievalMethod"/>
+ <element ref="ds:X509Data"/>
+ <element ref="ds:PGPData"/>
+ <element ref="ds:SPKIData"/>
+ <element ref="ds:MgmtData"/>
+ <any processContents="lax" namespace="##other"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ </choice>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="KeyName" type="string"/>
+ <element name="MgmtData" type="string"/>
+
+ <element name="KeyValue" type="ds:KeyValueType"/>
+ <complexType name="KeyValueType" mixed="true">
+ <choice>
+ <element ref="ds:DSAKeyValue"/>
+ <element ref="ds:RSAKeyValue"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </complexType>
+
+ <element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
+ <complexType name="RetrievalMethodType">
+ <sequence>
+ <element ref="ds:Transforms" minOccurs="0"/>
+ </sequence>
+ <attribute name="URI" type="anyURI"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+ </complexType>
+
+<!-- Start X509Data -->
+
+<element name="X509Data" type="ds:X509DataType"/>
+<complexType name="X509DataType">
+ <sequence maxOccurs="unbounded">
+ <choice>
+ <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
+ <element name="X509SKI" type="base64Binary"/>
+ <element name="X509SubjectName" type="string"/>
+ <element name="X509Certificate" type="base64Binary"/>
+ <element name="X509CRL" type="base64Binary"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+</complexType>
+
+<complexType name="X509IssuerSerialType">
+ <sequence>
+ <element name="X509IssuerName" type="string"/>
+ <element name="X509SerialNumber" type="integer"/>
+ </sequence>
+</complexType>
+
+<!-- End X509Data -->
+
+<!-- Begin PGPData -->
+
+<element name="PGPData" type="ds:PGPDataType"/>
+<complexType name="PGPDataType">
+ <choice>
+ <sequence>
+ <element name="PGPKeyID" type="base64Binary"/>
+ <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <sequence>
+ <element name="PGPKeyPacket" type="base64Binary"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </choice>
+</complexType>
+
+<!-- End PGPData -->
+
+<!-- Begin SPKIData -->
+
+<element name="SPKIData" type="ds:SPKIDataType"/>
+<complexType name="SPKIDataType">
+ <sequence maxOccurs="unbounded">
+ <element name="SPKISexp" type="base64Binary"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"/>
+ </sequence>
+</complexType>
+
+<!-- End SPKIData -->
+
+<!-- End KeyInfo -->
+
+<!-- Start Object (Manifest, SignatureProperty) -->
+
+<element name="Object" type="ds:ObjectType"/>
+<complexType name="ObjectType" mixed="true">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##any" processContents="lax"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet -->
+ <attribute name="Encoding" type="anyURI" use="optional"/>
+</complexType>
+
+<element name="Manifest" type="ds:ManifestType"/>
+<complexType name="ManifestType">
+ <sequence>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+<element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
+<complexType name="SignaturePropertiesType">
+ <sequence>
+ <element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureProperty" type="ds:SignaturePropertyType"/>
+ <complexType name="SignaturePropertyType" mixed="true">
+ <choice maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (1,unbounded) namespaces -->
+ </choice>
+ <attribute name="Target" type="anyURI" use="required"/>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+
+<!-- End Object (Manifest, SignatureProperty) -->
+
+<!-- Start Algorithm Parameters -->
+
+<simpleType name="HMACOutputLengthType">
+ <restriction base="integer"/>
+</simpleType>
+
+<!-- Start KeyValue Element-types -->
+
+<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+<complexType name="DSAKeyValueType">
+ <sequence>
+ <sequence minOccurs="0">
+ <element name="P" type="ds:CryptoBinary"/>
+ <element name="Q" type="ds:CryptoBinary"/>
+ </sequence>
+ <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ <element name="Y" type="ds:CryptoBinary"/>
+ <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
+ <sequence minOccurs="0">
+ <element name="Seed" type="ds:CryptoBinary"/>
+ <element name="PgenCounter" type="ds:CryptoBinary"/>
+ </sequence>
+ </sequence>
+</complexType>
+
+<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
+<complexType name="RSAKeyValueType">
+ <sequence>
+ <element name="Modulus" type="ds:CryptoBinary"/>
+ <element name="Exponent" type="ds:CryptoBinary"/>
+ </sequence>
+</complexType>
+
+<!-- End KeyValue Element-types -->
+
+<!-- End Signature -->
+
+</schema>
Added: identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmlenc/xenc-schema.xsd
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmlenc/xenc-schema.xsd (rev 0)
+++ identity-federation/trunk/identity-xmlsecmodel/src/main/resources/schema/w3c/xmlenc/xenc-schema.xsd 2009-01-05 21:06:01 UTC (rev 183)
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSchema 200102//EN"
+ "http://www.w3.org/2001/XMLSchema.dtd"
+ [
+ <!ATTLIST schema
+ xmlns:xenc CDATA #FIXED 'http://www.w3.org/2001/04/xmlenc#'
+ xmlns:ds CDATA #FIXED 'http://www.w3.org/2000/09/xmldsig#'>
+ <!ENTITY xenc 'http://www.w3.org/2001/04/xmlenc#'>
+ <!ENTITY % p ''>
+ <!ENTITY % s ''>
+ ]>
+
+<schema xmlns='http://www.w3.org/2001/XMLSchema' version='1.0'
+ xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'
+ xmlns:ds='http://www.w3.org/2000/09/xmldsig#'
+ targetNamespace='http://www.w3.org/2001/04/xmlenc#'
+ elementFormDefault='qualified'>
+
+ <import namespace='http://www.w3.org/2000/09/xmldsig#'
+ schemaLocation='http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd'/>
+
+ <complexType name='EncryptedType' abstract='true'>
+
+ <sequence>
+ <element name='EncryptionMethod' type='xenc:EncryptionMethodType'
+ minOccurs='0'/>
+ <element ref='ds:KeyInfo' minOccurs='0'/>
+ <element ref='xenc:CipherData'/>
+ <element ref='xenc:EncryptionProperties' minOccurs='0'/>
+ </sequence>
+ <attribute name='Id' type='ID' use='optional'/>
+ <attribute name='Type' type='anyURI' use='optional'/>
+ <attribute name='MimeType' type='string' use='optional'/>
+
+ <attribute name='Encoding' type='anyURI' use='optional'/>
+ </complexType>
+
+ <complexType name='EncryptionMethodType' mixed='true'>
+ <sequence>
+ <element name='KeySize' minOccurs='0' type='xenc:KeySizeType'/>
+ <element name='OAEPparams' minOccurs='0' type='base64Binary'/>
+ <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+ </sequence>
+ <attribute name='Algorithm' type='anyURI' use='required'/>
+
+ </complexType>
+
+ <simpleType name='KeySizeType'>
+ <restriction base="integer"/>
+ </simpleType>
+
+ <element name='CipherData' type='xenc:CipherDataType'/>
+ <complexType name='CipherDataType'>
+ <choice>
+ <element name='CipherValue' type='base64Binary'/>
+ <element ref='xenc:CipherReference'/>
+ </choice>
+ </complexType>
+
+ <element name='CipherReference' type='xenc:CipherReferenceType'/>
+ <complexType name='CipherReferenceType'>
+ <choice>
+ <element name='Transforms' type='xenc:TransformsType' minOccurs='0'/>
+ </choice>
+
+ <attribute name='URI' type='anyURI' use='required'/>
+ </complexType>
+
+ <complexType name='TransformsType'>
+ <sequence>
+ <element ref='ds:Transform' maxOccurs='unbounded'/>
+ </sequence>
+ </complexType>
+
+
+ <element name='EncryptedData' type='xenc:EncryptedDataType'/>
+ <complexType name='EncryptedDataType'>
+ <complexContent>
+ <extension base='xenc:EncryptedType'>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Children of ds:KeyInfo -->
+
+ <element name='EncryptedKey' type='xenc:EncryptedKeyType'/>
+ <complexType name='EncryptedKeyType'>
+ <complexContent>
+ <extension base='xenc:EncryptedType'>
+ <sequence>
+ <element ref='xenc:ReferenceList' minOccurs='0'/>
+ <element name='CarriedKeyName' type='string' minOccurs='0'/>
+ </sequence>
+ <attribute name='Recipient' type='string'
+ use='optional'/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="AgreementMethod" type="xenc:AgreementMethodType"/>
+ <complexType name="AgreementMethodType" mixed="true">
+ <sequence>
+ <element name="KA-Nonce" minOccurs="0" type="base64Binary"/>
+
+ <!-- <element ref="ds:DigestMethod" minOccurs="0"/> -->
+ <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="OriginatorKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
+ <element name="RecipientKeyInfo" minOccurs="0" type="ds:KeyInfoType"/>
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+ <!-- End Children of ds:KeyInfo -->
+
+ <element name='ReferenceList'>
+ <complexType>
+ <choice minOccurs='1' maxOccurs='unbounded'>
+ <element name='DataReference' type='xenc:ReferenceType'/>
+ <element name='KeyReference' type='xenc:ReferenceType'/>
+ </choice>
+ </complexType>
+ </element>
+
+ <complexType name='ReferenceType'>
+ <sequence>
+ <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+ </sequence>
+ <attribute name='URI' type='anyURI' use='required'/>
+ </complexType>
+
+
+ <element name='EncryptionProperties' type='xenc:EncryptionPropertiesType'/>
+
+ <complexType name='EncryptionPropertiesType'>
+ <sequence>
+ <element ref='xenc:EncryptionProperty' maxOccurs='unbounded'/>
+ </sequence>
+ <attribute name='Id' type='ID' use='optional'/>
+ </complexType>
+
+ <element name='EncryptionProperty' type='xenc:EncryptionPropertyType'/>
+ <complexType name='EncryptionPropertyType' mixed='true'>
+
+ <choice maxOccurs='unbounded'>
+ <any namespace='##other' processContents='lax'/>
+ </choice>
+ <attribute name='Target' type='anyURI' use='optional'/>
+ <attribute name='Id' type='ID' use='optional'/>
+ <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>
+ </complexType>
+
+</schema>
+
+
15 years, 4 months
JBoss Identity SVN: r182 - in identity-federation/trunk: identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-01-05 14:38:27 -0500 (Mon, 05 Jan 2009)
New Revision: 182
Modified:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SignatureValidationUnitTestCase.java
Log:
use the IDGenerator api
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -41,6 +41,7 @@
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.valves.ValveBase;
import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
@@ -162,7 +163,7 @@
}
//Create a response type
- String id = "ID_" + JBossSAMLBaseFactory.createUUID();
+ String id = IDGenerator.create("ID_");
IssuerInfoHolder issuerHolder = new IssuerInfoHolder(this.identityURL);
issuerHolder.setStatusCode(JBossSAMLURIConstants.STATUS_SUCCESS.get());
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -41,8 +41,8 @@
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.api.util.Base64;
@@ -145,7 +145,7 @@
throw new ServletException("serviceURL is not configured");
AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
- "ID_" + JBossSAMLBaseFactory.createUUID(), serviceURL,
+ IDGenerator.create("ID_"), serviceURL,
identityURL, serviceURL);
SAML2Request saml2Request = new SAML2Request();
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -40,8 +40,8 @@
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.valves.ValveBase;
import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.api.util.Base64;
@@ -127,7 +127,7 @@
Principal idpPrincipal = this.createGenericPrincipal(request, userName, roles);
Session session = request.getSessionInternal(true);
- session.setNote(Constants.REQ_SSOID_NOTE, JBossSAMLBaseFactory.createUUID());
+ session.setNote(Constants.REQ_SSOID_NOTE, IDGenerator.create());
request.setUserPrincipal(idpPrincipal);
session.setPrincipal(idpPrincipal);
}
@@ -138,7 +138,7 @@
throw new ServletException("serviceURL is not configured");
AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
- "ID_" + JBossSAMLBaseFactory.createUUID(), serviceURL,
+ IDGenerator.create("ID_"), serviceURL,
identityURL, serviceURL);
SAML2Request saml2Request = new SAML2Request();
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -72,9 +72,25 @@
private static ObjectFactory objectFactory = new ObjectFactory();
- private static XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM",
- new org.jcp.xml.dsig.internal.dom.XMLDSigRI());
+ private static XMLSignatureFactory fac = getXMLSignatureFactory();
+ private static XMLSignatureFactory getXMLSignatureFactory()
+ {
+ XMLSignatureFactory xsf = null;
+
+ try
+ {
+ xsf = XMLSignatureFactory.getInstance("DOM");
+ }
+ catch(Exception err)
+ {
+ //JDK5
+ xsf = XMLSignatureFactory.getInstance("DOM",
+ new org.jcp.xml.dsig.internal.dom.XMLDSigRI());
+ }
+ return xsf;
+ }
+
/**
* Sign an AuthnRequestType
* @param request
Modified: identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -26,8 +26,8 @@
import junit.framework.TestCase;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
import org.jboss.identity.federation.api.util.Base64;
import org.jboss.identity.federation.api.util.DeflateUtil;
@@ -44,7 +44,7 @@
public void testDeflateEncoding() throws Exception
{
AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
- "ID_" + JBossSAMLBaseFactory.createUUID(), "http://sp",
+ IDGenerator.create("ID_"), "http://sp",
"http://localhost:8080/idp","http://sp");
StringWriter sw = new StringWriter();
Modified: identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SignatureValidationUnitTestCase.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SignatureValidationUnitTestCase.java 2009-01-05 19:03:13 UTC (rev 181)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SignatureValidationUnitTestCase.java 2009-01-05 19:38:27 UTC (rev 182)
@@ -29,9 +29,9 @@
import javax.xml.crypto.dsig.DigestMethod;
import javax.xml.crypto.dsig.SignatureMethod;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
-import org.jboss.identity.federation.api.util.XMLSignatureUtil;
+import org.jboss.identity.federation.api.util.XMLSignatureUtil;
import org.jboss.identity.federation.core.saml.v2.util.SignatureUtil;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.junit.Test;
@@ -54,7 +54,7 @@
public void testAuthnRequestCreationWithSignature() throws Exception
{
AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
- "ID_" + JBossSAMLBaseFactory.createUUID(), "http://sp", "http://idp", "http://sp");
+ IDGenerator.create("ID_"), "http://sp", "http://idp", "http://sp");
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
KeyPair kp = kpg.genKeyPair();
Document signedDoc = XMLSignatureUtil.sign(authnRequest, kp.getPrivate(), null,
15 years, 4 months
JBoss Identity SVN: r180 - in identity-federation/trunk: identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp and 10 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-01-05 13:59:17 -0500 (Mon, 05 Jan 2009)
New Revision: 180
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/common/
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/common/IDGenerator.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SecurityActions.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/response/
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/response/SAML2Response.java
identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/exceptions/
identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/exceptions/AssertionExpiredException.java
Removed:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/exceptions/AssertionExpiredException.java
Modified:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnRequestFactory.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java
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/SAML2AuthnResponseUnitTestCase.java
Log:
refactor to introduce cleaner api
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -41,9 +41,10 @@
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.valves.ValveBase;
import org.apache.log4j.Logger;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
+import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.api.util.Base64;
import org.jboss.identity.federation.api.util.DeflateUtil;
import org.jboss.identity.federation.bindings.util.HTTPRedirectUtil;
@@ -105,9 +106,11 @@
{
try
{
+ SAML2Response saml2Response = new SAML2Response();
+
ResponseType responseType = this.getResponse(request, userPrincipal);
StringWriter stringWriter = new StringWriter();
- JBossSAMLAuthnResponseFactory.marshall(responseType, stringWriter);
+ saml2Response.marshall(responseType, stringWriter);
String responseMessage = stringWriter.toString();
@@ -145,14 +148,16 @@
byte[] decodedMessage = Base64.decode(getSAMLMessage(request));
InputStream is = DeflateUtil.decode(decodedMessage);
- AuthnRequestType authnRequestType = JBossSAMLAuthnRequestFactory.getAuthnRequestType(is);
+ SAML2Request saml2Request = new SAML2Request();
+
+ AuthnRequestType authnRequestType = saml2Request.getAuthnRequestType(is);
if(authnRequestType == null)
throw new IllegalStateException("AuthnRequest is null");
if(log.isTraceEnabled())
{
StringWriter sw = new StringWriter();
- JBossSAMLAuthnRequestFactory.marshall(authnRequestType, sw);
+ saml2Request.marshall(authnRequestType, sw);
log.trace("IDPRedirectValve::AuthnRequest="+sw.toString());
}
@@ -186,7 +191,8 @@
if(log.isTraceEnabled())
{
StringWriter sw = new StringWriter();
- JBossSAMLAuthnResponseFactory.marshall(responseType, sw);
+ SAML2Response saml2Response = new SAML2Response();
+ saml2Response.marshall(responseType, sw);
log.trace("IDPRedirectValve::Response="+sw.toString());
}
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -41,14 +41,15 @@
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.log4j.Logger;
-import org.jboss.identity.federation.api.saml.v2.exceptions.AssertionExpiredException;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
+import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.api.util.Base64;
import org.jboss.identity.federation.api.util.DeflateUtil;
import org.jboss.identity.federation.bindings.util.HTTPRedirectUtil;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
+import org.jboss.identity.federation.core.saml.v2.exceptions.AssertionExpiredException;
import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
import org.jboss.identity.federation.saml.v2.assertion.AttributeStatementType;
import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
@@ -146,9 +147,11 @@
AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
"ID_" + JBossSAMLBaseFactory.createUUID(), serviceURL,
identityURL, serviceURL);
-
+
+ SAML2Request saml2Request = new SAML2Request();
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(authnRequest, baos);
+ saml2Request.marshall(authnRequest, baos);
//Deflate encoding
byte[] deflatedMsg = DeflateUtil.encode(baos.toByteArray());
@@ -175,7 +178,9 @@
byte[] base64DecodedResponse = Base64.decode(samlResponse);
InputStream is = DeflateUtil.decode(base64DecodedResponse);
- ResponseType responseType = JBossSAMLAuthnResponseFactory.getResponseType(is);
+ SAML2Response saml2Response = new SAML2Response();
+
+ ResponseType responseType = saml2Response.getResponseType(is);
StatusType statusType = responseType.getStatus();
if(statusType == null)
throw new Exception("Status Type from the IDP is null");
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectValve.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -41,11 +41,12 @@
import org.apache.catalina.valves.ValveBase;
import org.apache.log4j.Logger;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
+import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.api.util.Base64;
import org.jboss.identity.federation.api.util.DeflateUtil;
-import org.jboss.identity.federation.bindings.util.HTTPRedirectUtil;
+import org.jboss.identity.federation.bindings.util.HTTPRedirectUtil;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
import org.jboss.identity.federation.saml.v2.assertion.AttributeStatementType;
@@ -95,7 +96,9 @@
byte[] base64DecodedResponse = Base64.decode(samlResponse);
InputStream is = DeflateUtil.decode(base64DecodedResponse);
- ResponseType responseType = JBossSAMLAuthnResponseFactory.getResponseType(is);
+ SAML2Response saml2Response = new SAML2Response();
+
+ ResponseType responseType = saml2Response.getResponseType(is);
StatusType statusType = responseType.getStatus();
if(statusType == null)
throw new Exception("Status Type from the IDP is null");
@@ -138,8 +141,10 @@
"ID_" + JBossSAMLBaseFactory.createUUID(), serviceURL,
identityURL, serviceURL);
+ SAML2Request saml2Request = new SAML2Request();
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(authnRequest, baos);
+ saml2Request.marshall(authnRequest, baos);
//Deflate encoding
byte[] deflatedMsg = DeflateUtil.encode(baos.toByteArray());
Added: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/common/IDGenerator.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/common/IDGenerator.java (rev 0)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/common/IDGenerator.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -0,0 +1,55 @@
+/*
+ * 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.identity.federation.api.saml.v2.common;
+
+import java.util.UUID;
+
+/**
+ * Utility class that generates unique IDs
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 5, 2009
+ */
+public class IDGenerator
+{
+ /*
+ * Create a basic unique ID
+ */
+ public static String create()
+ {
+ return UUID.randomUUID().toString();
+ }
+
+ /**
+ * Create an id that is prefixed by a string
+ * @param prefix
+ * @return an id
+ * @throws IllegalArgumentException when prefix is null
+ */
+ public static String create(String prefix)
+ {
+ if(prefix == null)
+ throw new IllegalArgumentException("prefix is null");
+ StringBuilder sb = new StringBuilder(prefix);
+ sb.append(IDGenerator.create());
+ return sb.toString();
+ }
+}
\ No newline at end of file
Deleted: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/exceptions/AssertionExpiredException.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/exceptions/AssertionExpiredException.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/exceptions/AssertionExpiredException.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -1,52 +0,0 @@
-/*
- * 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.identity.federation.api.saml.v2.exceptions;
-
-import java.security.GeneralSecurityException;
-
-/**
- * Security Exception indicating expiration of SAML2 assertion
- * @author Anil.Saldhana(a)redhat.com
- * @since Dec 12, 2008
- */
-public class AssertionExpiredException extends GeneralSecurityException
-{
- private static final long serialVersionUID = 1L;
-
- public AssertionExpiredException()
- {
- }
-
- public AssertionExpiredException(String message, Throwable cause)
- {
- }
-
- public AssertionExpiredException(String msg)
- {
- super(msg);
- }
-
- public AssertionExpiredException(Throwable cause)
- {
- super(cause);
- }
-}
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnRequestFactory.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnRequestFactory.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnRequestFactory.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -21,10 +21,6 @@
*/
package org.jboss.identity.federation.api.saml.v2.factories;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
@@ -95,65 +91,34 @@
public static JAXBElement<AuthnRequestType> createAuthnRequestType(AuthnRequestType authnRequestType)
{
return protocolObjectFactory.createAuthnRequest(authnRequestType);
- }
+ }
/**
- * Get AuthnRequestType from a file
- * @param fileName file with the serialized AuthnRequestType
- * @return AuthnRequestType
- * @throws Exception
- * @throws IllegalArgumentException if the input fileName is null
- * IllegalStateException if the InputStream from the fileName is null
+ * Get the Object Factory useful for dealing with SAML2 requests
+ * @return
*/
- public static AuthnRequestType getAuthnRequestType(String fileName) throws Exception
- {
- if(fileName == null)
- throw new IllegalArgumentException("fileName is null");
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- InputStream is = tcl.getResourceAsStream(fileName);
- return getAuthnRequestType(is);
+ public static ObjectFactory getObjectFactory()
+ {
+ return protocolObjectFactory;
}
/**
- * Get the AuthnRequestType from an input stream
- * @param is Inputstream containing the AuthnRequest
+ * Get the validating marshaller
* @return
* @throws Exception
- * @throws IllegalArgumentException inputstream is null
*/
- @SuppressWarnings("unchecked")
- public static AuthnRequestType getAuthnRequestType(InputStream is) throws Exception
+ public static Marshaller getValidatingMarshaller() throws Exception
{
- if(is == null)
- throw new IllegalStateException("InputStream is null");
- Unmarshaller un = JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
- JAXBElement<AuthnRequestType> jaxbAuthnRequestType = (JAXBElement<AuthnRequestType>) un.unmarshal(is);
- return jaxbAuthnRequestType.getValue();
- }
-
- /**
- * Marshall the AuthnRequestType to an output stream
- * @param requestType
- * @param os
- * @throws Exception
- */
- public static void marshall(AuthnRequestType requestType, OutputStream os) throws Exception
- {
- Marshaller marshaller = JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
- JAXBElement<AuthnRequestType> jaxb = protocolObjectFactory.createAuthnRequest(requestType);
- marshaller.marshal(jaxb, os);
+ return JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
}
/**
- * Marshall the AuthnRequestType to a writer
- * @param requestType
- * @param writer
+ * Get the validating unmarshaller
+ * @return
* @throws Exception
*/
- public static void marshall(AuthnRequestType requestType, Writer writer) throws Exception
+ public static Unmarshaller getValidatingUnmarshaller() throws Exception
{
- Marshaller marshaller = JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
- JAXBElement<AuthnRequestType> jaxb = protocolObjectFactory.createAuthnRequest(requestType);
- marshaller.marshal(jaxb, writer);
+ return JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
}
}
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -21,10 +21,6 @@
*/
package org.jboss.identity.federation.api.saml.v2.factories;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
@@ -147,49 +143,31 @@
}
/**
- * Read a ResponseType from an input stream
- * @param is
+ * Return the JAXB2 object factory (mainly for invocation chaining)
* @return
- * @throws Exception
*/
- @SuppressWarnings("unchecked")
- public static ResponseType getResponseType(InputStream is) throws Exception
+ public static ObjectFactory getObjectFactory()
{
- if(is == null)
- throw new IllegalArgumentException("inputstream is null");
-
- Unmarshaller un = JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
- JAXBElement<ResponseType> jaxbAuthnRequestType = (JAXBElement<ResponseType>) un.unmarshal(is);
- return jaxbAuthnRequestType.getValue();
+ return protocolObjectFactory;
}
/**
- * Marshall the response type to the output stream
- * <p> <b>Note:</b> JAXB marshaller by default picks up arbitrary namespace
- * prefixes (ns2,ns3 etc). The NamespacePrefixMapper is a Sun RI customization
- * that may be needed (this is a TODO) to get a prefix such as saml, samlp </b>
- *
- * @param responseType
- * @param os
+ * Get the JAXB2 marshaller
+ * @return
* @throws Exception
*/
- public static void marshall(ResponseType responseType, OutputStream os) throws Exception
+ public static Marshaller getValidatingMarshaller() throws Exception
{
- Marshaller marshaller = JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
- JAXBElement<ResponseType> jaxb = protocolObjectFactory.createResponse(responseType);
- marshaller.marshal(jaxb, os);
+ return JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
}
-
+
/**
- * Marshall the ResponseType into a writer
- * @param responseType
- * @param writer
+ * Get the JAXB2 Unmarshaller
+ * @return
* @throws Exception
*/
- public static void marshall(ResponseType responseType, Writer writer) throws Exception
+ public static Unmarshaller getValidatingUnmarshaller() throws Exception
{
- Marshaller marshaller = JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
- JAXBElement<ResponseType> jaxb = protocolObjectFactory.createResponse(responseType);
- marshaller.marshal(jaxb, writer);
+ return JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
}
}
\ No newline at end of file
Added: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java (rev 0)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -0,0 +1,110 @@
+/*
+ * 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.identity.federation.api.saml.v2.request;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
+import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
+
+/**
+ * API for SAML2 Request
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 5, 2009
+ */
+public class SAML2Request
+{
+ public AuthnRequestType createAuthnRequestType(String id,
+ String assertionConsumerURL,
+ String destination,
+ String issuerValue) throws Exception
+ {
+ return JBossSAMLAuthnRequestFactory.createAuthnRequestType(
+ id, assertionConsumerURL, destination, issuerValue);
+ }
+
+ /**
+ * Get AuthnRequestType from a file
+ * @param fileName file with the serialized AuthnRequestType
+ * @return AuthnRequestType
+ * @throws Exception
+ * @throws IllegalArgumentException if the input fileName is null
+ * IllegalStateException if the InputStream from the fileName is null
+ */
+ public AuthnRequestType getAuthnRequestType(String fileName) throws Exception
+ {
+ if(fileName == null)
+ throw new IllegalArgumentException("fileName is null");
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ InputStream is = tcl.getResourceAsStream(fileName);
+ return getAuthnRequestType(is);
+ }
+
+ /**
+ * Get the AuthnRequestType from an input stream
+ * @param is Inputstream containing the AuthnRequest
+ * @return
+ * @throws Exception
+ * @throws IllegalArgumentException inputstream is null
+ */
+ @SuppressWarnings("unchecked")
+ public AuthnRequestType getAuthnRequestType(InputStream is) throws Exception
+ {
+ if(is == null)
+ throw new IllegalStateException("InputStream is null");
+ Unmarshaller un = JBossSAMLAuthnRequestFactory.getValidatingUnmarshaller();
+ JAXBElement<AuthnRequestType> jaxbAuthnRequestType = (JAXBElement<AuthnRequestType>) un.unmarshal(is);
+ return jaxbAuthnRequestType.getValue();
+ }
+
+ /**
+ * Marshall the AuthnRequestType to an output stream
+ * @param requestType
+ * @param os
+ * @throws Exception
+ */
+ public void marshall(AuthnRequestType requestType, OutputStream os) throws Exception
+ {
+ Marshaller marshaller = JBossSAMLAuthnRequestFactory.getValidatingMarshaller();
+ JAXBElement<AuthnRequestType> jaxb = JBossSAMLAuthnRequestFactory.getObjectFactory().createAuthnRequest(requestType);
+ marshaller.marshal(jaxb, os);
+ }
+
+ /**
+ * Marshall the AuthnRequestType to a writer
+ * @param requestType
+ * @param writer
+ * @throws Exception
+ */
+ public void marshall(AuthnRequestType requestType, Writer writer) throws Exception
+ {
+ Marshaller marshaller = JBossSAMLAuthnRequestFactory.getValidatingMarshaller();
+ JAXBElement<AuthnRequestType> jaxb = JBossSAMLAuthnRequestFactory.getObjectFactory().createAuthnRequest(requestType);
+ marshaller.marshal(jaxb, writer);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SecurityActions.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SecurityActions.java (rev 0)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SecurityActions.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -0,0 +1,48 @@
+/*
+ * 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.identity.federation.api.saml.v2.request;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Dec 9, 2008
+ */
+class SecurityActions
+{
+ /**
+ * Get the Thread Context ClassLoader
+ * @return
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+}
Added: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/response/SAML2Response.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/response/SAML2Response.java (rev 0)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/response/SAML2Response.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -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.identity.federation.api.saml.v2.response;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
+import org.jboss.identity.federation.core.saml.v2.holders.IDPInfoHolder;
+import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
+import org.jboss.identity.federation.core.saml.v2.holders.SPInfoHolder;
+import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
+
+/**
+ * API for dealing with SAML2 Response objects
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 5, 2009
+ */
+public class SAML2Response
+{
+ /**
+ * Create a ResponseType
+ * @param ID id of the response
+ * @param sp holder with the information about the Service Provider
+ * @param idp holder with the information on the Identity Provider
+ * @param issuerInfo holder with information on the issuer
+ * @return
+ * @throws Exception
+ */
+ public ResponseType createResponseType(String ID, SPInfoHolder sp, IDPInfoHolder idp, IssuerInfoHolder issuerInfo) throws Exception
+ {
+ return JBossSAMLAuthnResponseFactory.createResponseType(ID, sp, idp, issuerInfo);
+ }
+
+ /**
+ * Read a ResponseType from an input stream
+ * @param is
+ * @return
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public ResponseType getResponseType(InputStream is) throws Exception
+ {
+ if(is == null)
+ throw new IllegalArgumentException("inputstream is null");
+
+ Unmarshaller un = JBossSAMLAuthnResponseFactory.getValidatingUnmarshaller();
+ JAXBElement<ResponseType> jaxbAuthnRequestType = (JAXBElement<ResponseType>) un.unmarshal(is);
+ return jaxbAuthnRequestType.getValue();
+ }
+
+ /**
+ * Marshall the response type to the output stream
+ * <p> <b>Note:</b> JAXB marshaller by default picks up arbitrary namespace
+ * prefixes (ns2,ns3 etc). The NamespacePrefixMapper is a Sun RI customization
+ * that may be needed (this is a TODO) to get a prefix such as saml, samlp </b>
+ *
+ * @param responseType
+ * @param os
+ * @throws Exception
+ */
+ public void marshall(ResponseType responseType, OutputStream os) throws Exception
+ {
+ Marshaller marshaller = JBossSAMLAuthnResponseFactory.getValidatingMarshaller();
+ JAXBElement<ResponseType> jaxb = JBossSAMLAuthnResponseFactory.getObjectFactory().createResponse(responseType);
+ marshaller.marshal(jaxb, os);
+ }
+
+ /**
+ * Marshall the ResponseType into a writer
+ * @param responseType
+ * @param writer
+ * @throws Exception
+ */
+ public void marshall(ResponseType responseType, Writer writer) throws Exception
+ {
+ Marshaller marshaller = JBossSAMLAuthnResponseFactory.getValidatingMarshaller();
+ JAXBElement<ResponseType> jaxb = JBossSAMLAuthnResponseFactory.getObjectFactory().createResponse(responseType);
+ marshaller.marshal(jaxb, writer);
+ }
+}
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -52,8 +52,8 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.jboss.identity.federation.w3.xmldsig.ObjectFactory;
import org.jboss.identity.federation.w3.xmldsig.SignatureType;
@@ -92,8 +92,10 @@
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
+ SAML2Request saml2Request = new SAML2Request();
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(request, baos);
+ saml2Request.marshall(request, baos);
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc = builder.parse(new ByteArrayInputStream(baos.toByteArray()) );
@@ -145,8 +147,10 @@
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
+ SAML2Request saml2Request = new SAML2Request();
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(request, baos);
+ saml2Request.marshall(request, baos);
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc = builder.parse(new ByteArrayInputStream(baos.toByteArray()) );
Modified: identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/DeflateEncodingDecodingUnitTestCase.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -24,14 +24,15 @@
import java.io.InputStream;
import java.io.StringWriter;
+import junit.framework.TestCase;
+
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
import org.jboss.identity.federation.api.util.Base64;
import org.jboss.identity.federation.api.util.DeflateUtil;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
-import junit.framework.TestCase;
-
/**
* Unit test the DEFLATE compression
* encoding/decoding cycles
@@ -47,7 +48,8 @@
"http://localhost:8080/idp","http://sp");
StringWriter sw = new StringWriter();
- JBossSAMLAuthnRequestFactory.marshall(authnRequest, sw);
+ SAML2Request request = new SAML2Request();
+ request.marshall(authnRequest, sw);
byte[] deflatedMsg = DeflateUtil.encode(sw.toString());
String base64Request = Base64.encodeBytes(deflatedMsg, Base64.DONT_BREAK_LINES);
@@ -55,7 +57,7 @@
//Decode
byte[] decodedMessage = Base64.decode(base64Request);
InputStream is = DeflateUtil.decode(decodedMessage);
- AuthnRequestType decodedRequestType = JBossSAMLAuthnRequestFactory.getAuthnRequestType(is);
+ AuthnRequestType decodedRequestType = request.getAuthnRequestType(is);
assertNotNull(decodedRequestType);
}
Modified: 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 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnRequestUnitTestCase.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -28,8 +28,8 @@
import junit.framework.TestCase;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnRequestFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
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;
@@ -56,8 +56,10 @@
{
String resourceName = "saml/v2/authnrequest/samlAuthnRequestExample.xml";
- AuthnRequestType authnRequestType = JBossSAMLAuthnRequestFactory.getAuthnRequestType(resourceName);
+ SAML2Request request = new SAML2Request();
+ AuthnRequestType authnRequestType = request.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.getAssertionConsumerServiceURL());
@@ -90,7 +92,7 @@
//Let us marshall it back to an output stream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(authnRequestType, baos);
+ request.marshall(authnRequestType, baos);
}
/**
@@ -102,7 +104,9 @@
{
String resourceName = "saml/v2/authnrequest/samlAuthnRequestWithSignature.xml";
- AuthnRequestType authnRequestType = JBossSAMLAuthnRequestFactory.getAuthnRequestType(resourceName);
+ SAML2Request request = new SAML2Request();
+
+ AuthnRequestType authnRequestType = request.getAuthnRequestType(resourceName);
assertNotNull(authnRequestType);
SignatureType signatureType = authnRequestType.getSignature();
@@ -110,7 +114,7 @@
//Let us marshall it back to an output stream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(authnRequestType, baos);
+ request.marshall(authnRequestType, baos);
}
/**
@@ -119,10 +123,13 @@
*/
public void testAuthnRequestCreation() throws Exception
{
- AuthnRequestType authnRequest = JBossSAMLAuthnRequestFactory.createAuthnRequestType(
- "ID_" + JBossSAMLBaseFactory.createUUID(), "http://sp", "http://idp", "http://sp");
+ String id = IDGenerator.create("ID_");
+
+ SAML2Request request = new SAML2Request();
+ AuthnRequestType authnRequest = request.createAuthnRequestType(
+ id, "http://sp", "http://idp", "http://sp");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnRequestFactory.marshall(authnRequest, baos);
+ request.marshall(authnRequest, baos);
}
}
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnResponseUnitTestCase.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnResponseUnitTestCase.java 2008-12-17 18:57:46 UTC (rev 179)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2AuthnResponseUnitTestCase.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -23,17 +23,18 @@
import java.io.ByteArrayOutputStream;
+import junit.framework.TestCase;
+
+import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLAuthnResponseFactory;
-import org.jboss.identity.federation.api.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.jboss.identity.federation.core.saml.v2.holders.IDPInfoHolder;
import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
-import org.jboss.identity.federation.core.saml.v2.holders.SPInfoHolder;
+import org.jboss.identity.federation.core.saml.v2.holders.SPInfoHolder;
import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
-import junit.framework.TestCase;
-
/**
* Unit Test the SAML2 Authn Response factory
* @author Anil.Saldhana(a)redhat.com
@@ -48,13 +49,14 @@
issuerHolder.setStatusCode(JBossSAMLURIConstants.STATUS_SUCCESS.get());
IDPInfoHolder idp = new IDPInfoHolder();
- idp.setNameIDFormatValue(JBossSAMLBaseFactory.createUUID().toString());
+ idp.setNameIDFormatValue(IDGenerator.create());
ResponseType rt = JBossSAMLAuthnResponseFactory.createResponseType("response111",
new SPInfoHolder(), idp, issuerHolder);
assertNotNull(rt);
+ SAML2Response saml2Response = new SAML2Response();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- JBossSAMLAuthnResponseFactory.marshall(rt, baos);
+ saml2Response.marshall(rt, baos);
}
}
\ No newline at end of file
Added: identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/exceptions/AssertionExpiredException.java
===================================================================
--- identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/exceptions/AssertionExpiredException.java (rev 0)
+++ identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/exceptions/AssertionExpiredException.java 2009-01-05 18:59:17 UTC (rev 180)
@@ -0,0 +1,52 @@
+/*
+ * 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.identity.federation.core.saml.v2.exceptions;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * Security Exception indicating expiration of SAML2 assertion
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Dec 12, 2008
+ */
+public class AssertionExpiredException extends GeneralSecurityException
+{
+ private static final long serialVersionUID = 1L;
+
+ public AssertionExpiredException()
+ {
+ }
+
+ public AssertionExpiredException(String message, Throwable cause)
+ {
+ }
+
+ public AssertionExpiredException(String msg)
+ {
+ super(msg);
+ }
+
+ public AssertionExpiredException(Throwable cause)
+ {
+ super(cause);
+ }
+}
\ No newline at end of file
15 years, 4 months