JBoss Identity SVN: r536 - in identity-federation/trunk: jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-26 11:43:37 -0400 (Tue, 26 May 2009)
New Revision: 536
Removed:
identity-federation/trunk/jboss-identity-xmlsec-model/src/main/java/org/jboss/identity/xmlsec/util/XMLEncryptionUtil.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectWithSignatureValve.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java
identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/util/XMLEncryptionUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java
identity-federation/trunk/jboss-identity-fed-model/pom.xml
Log:
JBID-112: consolidate the xmlenc utility
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectWithSignatureValve.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectWithSignatureValve.java 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectWithSignatureValve.java 2009-05-26 15:43:37 UTC (rev 536)
@@ -56,7 +56,7 @@
import org.jboss.identity.federation.core.saml.v2.util.SignatureUtil;
import org.jboss.identity.federation.saml.v2.assertion.EncryptedElementType;
import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
-import org.jboss.identity.xmlsec.util.XMLEncryptionUtil;
+import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java 2009-05-26 15:43:37 UTC (rev 536)
@@ -45,7 +45,7 @@
import org.jboss.identity.federation.core.saml.v2.util.SignatureUtil;
import org.jboss.identity.federation.saml.v2.assertion.EncryptedElementType;
import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
-import org.jboss.identity.xmlsec.util.XMLEncryptionUtil;
+import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
Modified: identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/util/XMLEncryptionUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/util/XMLEncryptionUnitTestCase.java 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/util/XMLEncryptionUnitTestCase.java 2009-05-26 15:43:37 UTC (rev 536)
@@ -43,11 +43,11 @@
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.util.DocumentUtil;
+import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
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.EncryptedElementType;
-import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
-import org.jboss.identity.xmlsec.util.XMLEncryptionUtil;
+import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java 2009-05-26 15:43:37 UTC (rev 536)
@@ -21,17 +21,49 @@
*/
package org.jboss.identity.federation.core.util;
+import java.security.Key;
+import java.security.PrivateKey;
+import java.security.PublicKey;
import java.util.HashMap;
+import javax.crypto.SecretKey;
+import javax.xml.namespace.QName;
+
+import org.apache.xml.security.encryption.EncryptedData;
+import org.apache.xml.security.encryption.EncryptedKey;
import org.apache.xml.security.encryption.XMLCipher;
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* Utility for XML Encryption
+ * <b>Note: </b> This utility is currently using Apache XML Security
+ * library API. JSR-106 is not yet final. Until that happens,we
+ * rely on the non-standard API.
+ *
* @author Anil.Saldhana(a)redhat.com
* @since May 4, 2009
*/
public class XMLEncryptionUtil
{
+ static
+ {
+ //Initialize the Apache XML Security Library
+ org.apache.xml.security.Init.init();
+ }
+
+ public static final String CIPHER_DATA_LOCALNAME = "CipherData";
+ public static final String ENCRYPTED_KEY_LOCALNAME = "EncryptedKey";
+ public static final String DS_KEY_INFO = "ds:KeyInfo";
+
+ public static final String XMLNS = "http://www.w3.org/2000/xmlns/";
+ public static String XMLSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
+ public static String XMLENC_NS = "http://www.w3.org/2001/04/xmlenc#";
+
+
private static HashMap <String, EncryptionAlgorithm> algorithms
= new HashMap<String, EncryptionAlgorithm>(4);
@@ -85,4 +117,338 @@
throw new RuntimeException("Unknown jce algorithm:" + certAlgo);
return ea.size;
}
+
+
+
+ /**
+ * <p>
+ * Encrypt the Key to be transported
+ * </p>
+ * <p>
+ * Data is encrypted with a SecretKey. Then the key needs to be
+ * transported to the other end where it is needed for decryption.
+ * For the Key transport, the SecretKey is encrypted with the
+ * recipient's public key. At the receiving end, the receiver
+ * can decrypt the Secret Key using his private key.s
+ * </p>
+ * @param document
+ * @param keyToBeEncrypted Symmetric Key (SecretKey)
+ * @param keyUsedToEncryptSecretKey Asymmetric Key (Public Key)
+ * @param keySize Length of the key
+ * @return
+ * @throws XMLSecurityException
+ */
+ public static EncryptedKey encryptKey(Document document,
+ SecretKey keyToBeEncrypted, PublicKey keyUsedToEncryptSecretKey,
+ int keySize) throws XMLSecurityException
+ {
+ XMLCipher keyCipher = null;
+ String pubKeyAlg = keyUsedToEncryptSecretKey.getAlgorithm();
+
+ String keyWrapAlgo = getXMLEncryptionURLForKeyUnwrap(pubKeyAlg, keySize);
+ keyCipher = XMLCipher.getInstance(keyWrapAlgo);
+
+ keyCipher.init(XMLCipher.WRAP_MODE, keyUsedToEncryptSecretKey);
+ return keyCipher.encryptKey(document, keyToBeEncrypted);
+ }
+
+ /**
+ * Given an element in a Document, encrypt the element and replace
+ * the element in the document with the encrypted data
+ * @param elementQName QName of the element that we like to encrypt
+ * @param publicKey
+ * @param secretKey
+ * @param keySize
+ * @param wrappingElementQName A QName of an element that will wrap the encrypted element
+ * @param addEncryptedKeyInKeyInfo Need for the EncryptedKey to be placed in ds:KeyInfo
+ * @return
+ * @throws Exception
+ */
+ public static void encryptElement(QName elementQName,
+ Document document,
+ PublicKey publicKey,
+ SecretKey secretKey, int keySize, QName wrappingElementQName,
+ boolean addEncryptedKeyInKeyInfo) throws Exception
+ {
+ if(elementQName == null)
+ throw new IllegalArgumentException("elementQName is null");
+ if(document == null)
+ throw new IllegalArgumentException("document is null");
+ String wrappingElementPrefix = wrappingElementQName.getPrefix();
+ if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ throw new IllegalArgumentException("Wrapping element prefix invalid");
+
+ NodeList elements = document.getElementsByTagName(elementQName.toString());
+ if(elements == null || elements.getLength() > 1)
+ throw new IllegalStateException("Element was either null or more than one:"+elements);
+ Element documentElement = (Element) elements.item(0);
+
+ if(documentElement == null)
+ throw new IllegalStateException("Element could not be found in the document:"+ elementQName.toString());
+
+ XMLCipher cipher = null;
+ EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
+
+ String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
+ //Encrypt the Document
+ cipher = XMLCipher.getInstance(encryptionAlgorithm);
+ cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+
+ Document encryptedDoc = cipher.doFinal(document, documentElement);
+
+ // The EncryptedKey element is added
+ Element encryptedKeyElement = cipher.martial(document, encryptedKey);
+
+ String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
+
+ //Create the wrapping element and set its attribute NS
+ Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
+ wrappingElementName);
+
+ if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ {
+ wrappingElementName = wrappingElementQName.getLocalPart();
+ }
+ wrappingElement.setAttributeNS(XMLNS,
+ "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
+
+ //Get Hold of the Cipher Data
+ NodeList cipherElements = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, "EncryptedData");
+ if(cipherElements == null || cipherElements.getLength() == 0)
+ throw new IllegalStateException("xenc:EncryptedData Element Missing");
+ Element encryptedDataElement = (Element) cipherElements.item(0);
+
+ Node parentOfEncNode = encryptedDataElement.getParentNode();
+ parentOfEncNode.replaceChild(wrappingElement, encryptedDataElement);
+
+ wrappingElement.appendChild(encryptedDataElement);
+
+ if (addEncryptedKeyInKeyInfo)
+ {
+ // Outer ds:KeyInfo Element to hold the EncryptionKey
+ Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
+ sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
+ sigElement.appendChild(encryptedKeyElement);
+
+ //Insert the Encrypted key before the CipherData element
+ NodeList nodeList = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
+ if (nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("xenc:CipherData Element Missing");
+ Element cipherDataElement = (Element) nodeList.item(0);
+ Node cipherParent = cipherDataElement.getParentNode();
+ cipherParent.insertBefore(sigElement, cipherDataElement);
+ }
+ else
+ {
+ //Add the encrypted key as a child of the wrapping element
+ wrappingElement.appendChild(encryptedKeyElement);
+ }
+ }
+
+
+ /**
+ * Encrypt the root document element inside a Document.
+ * <b>NOTE:</> The document root element will be replaced
+ * by the wrapping element.
+ *
+ * @param document Document that contains an element to encrypt
+ * @param publicKey The Public Key used to encrypt the secret encryption key
+ * @param secretKey The secret encryption key
+ * @param keySize Length of key
+ * @param wrappingElementQName QName of the element to be used to wrap around
+ * the cipher data.
+ * @param addEncryptedKeyInKeyInfo Should the encrypted key be inside a KeyInfo
+ * or added as a peer of Cipher Data
+ * @return An element that has the wrappingElementQName
+ * @throws Exception
+ */
+ public static Element encryptElementInDocument(Document document,
+ PublicKey publicKey,
+ SecretKey secretKey, int keySize, QName wrappingElementQName,
+ boolean addEncryptedKeyInKeyInfo) throws Exception
+ {
+ String wrappingElementPrefix = wrappingElementQName.getPrefix();
+ if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ throw new IllegalArgumentException("Wrapping element prefix invalid");
+
+ XMLCipher cipher = null;
+ EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
+
+ String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
+ //Encrypt the Document
+ cipher = XMLCipher.getInstance(encryptionAlgorithm);
+ cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+
+ Document encryptedDoc = cipher.doFinal(document, document.getDocumentElement());
+
+ // The EncryptedKey element is added
+ Element encryptedKeyElement = cipher.martial(document, encryptedKey);
+
+ String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
+
+ //Create the wrapping element and set its attribute NS
+ Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
+ wrappingElementName);
+
+ if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ {
+ wrappingElementName = wrappingElementQName.getLocalPart();
+ }
+ wrappingElement.setAttributeNS(XMLNS,
+ "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
+
+ Element encryptedDocRootElement = encryptedDoc.getDocumentElement();
+ //Bring in the encrypted wrapping element to wrap the root node
+ encryptedDoc.replaceChild(wrappingElement, encryptedDocRootElement);
+
+ wrappingElement.appendChild(encryptedDocRootElement);
+
+ if (addEncryptedKeyInKeyInfo)
+ {
+ // Outer ds:KeyInfo Element to hold the EncryptionKey
+ Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
+ sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
+ sigElement.appendChild(encryptedKeyElement);
+
+ //Insert the Encrypted key before the CipherData element
+ NodeList nodeList = encryptedDocRootElement.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
+ if (nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("xenc:CipherData Element Missing");
+
+ Element cipherDataElement = (Element) nodeList.item(0);
+ encryptedDocRootElement.insertBefore(sigElement, cipherDataElement);
+ }
+ else
+ {
+ //Add the encrypted key as a child of the wrapping element
+ wrappingElement.appendChild(encryptedKeyElement);
+ }
+
+ return encryptedDoc.getDocumentElement();
+ }
+
+ /**
+ * Decrypt an encrypted element inside a document
+ * @param documentWithEncryptedElement
+ * @param privateKey key need to unwrap the encryption key
+ * @return the document with the encrypted element replaced by the data element
+ * @throws Exception
+ */
+ public static Element decryptElementInDocument(Document documentWithEncryptedElement,
+ PrivateKey privateKey) throws Exception
+ {
+ if(documentWithEncryptedElement == null)
+ throw new IllegalArgumentException("Input document is null");
+
+ //Look for encrypted data element
+ Element documentRoot = documentWithEncryptedElement.getDocumentElement();
+ Element encDataElement = getNextElementNode(documentRoot.getFirstChild());
+ if(encDataElement == null)
+ throw new IllegalStateException("No element representing the encrypted data found");
+
+ //Look at siblings for the key
+ Element encKeyElement = getNextElementNode(encDataElement.getNextSibling());
+ if(encKeyElement == null)
+ {
+ //Search the enc data element for enc key
+ NodeList nodeList = encDataElement.getElementsByTagNameNS( XMLENC_NS, ENCRYPTED_KEY_LOCALNAME);
+
+ if(nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("Encrypted Key not found in the enc data");
+
+ encKeyElement = (Element) nodeList.item(0);
+ }
+
+ XMLCipher cipher = XMLCipher.getInstance();
+ cipher.init(XMLCipher.DECRYPT_MODE, null);
+ EncryptedData encryptedData = cipher.loadEncryptedData(documentWithEncryptedElement, encDataElement);
+ EncryptedKey encryptedKey = cipher.loadEncryptedKey(documentWithEncryptedElement, encKeyElement);
+
+ Document decryptedDoc = null;
+
+ if (encryptedData != null && encryptedKey != null)
+ {
+ String encAlgoURL = encryptedData.getEncryptionMethod().getAlgorithm();
+ XMLCipher keyCipher = XMLCipher.getInstance();
+ keyCipher.init(XMLCipher.UNWRAP_MODE, privateKey);
+ Key encryptionKey = keyCipher.decryptKey( encryptedKey, encAlgoURL );
+ cipher = XMLCipher.getInstance();
+ cipher.init(XMLCipher.DECRYPT_MODE, encryptionKey);
+ decryptedDoc = cipher.doFinal(documentWithEncryptedElement, encDataElement);
+ }
+
+ Element decryptedRoot = decryptedDoc.getDocumentElement();
+ Element dataElement = getNextElementNode(decryptedRoot.getFirstChild());
+ if (dataElement == null)
+ throw new IllegalStateException("Data Element after encryption is null");
+
+ decryptedRoot.removeChild(dataElement);
+ decryptedDoc.replaceChild(dataElement, decryptedRoot);
+
+ return decryptedDoc.getDocumentElement();
+ }
+
+ /**
+ * From the secret key, get the W3C XML Encryption URL
+ * @param publicKeyAlgo
+ * @param keySize
+ * @return
+ */
+ private static String getXMLEncryptionURLForKeyUnwrap(String publicKeyAlgo, int keySize)
+ {
+ if("AES".equals(publicKeyAlgo))
+ {
+ switch(keySize)
+ {
+ case 192: return XMLCipher.AES_192_KeyWrap;
+ case 256: return XMLCipher.AES_256_KeyWrap;
+ default:
+ return XMLCipher.AES_128_KeyWrap;
+ }
+ }
+ if(publicKeyAlgo.contains("RSA"))
+ return XMLCipher.RSA_v1dot5;
+ if(publicKeyAlgo.contains("DES"))
+ return XMLCipher.TRIPLEDES_KeyWrap;
+ throw new IllegalArgumentException("unsupported publicKey Algo:" + publicKeyAlgo);
+ }
+
+ /**
+ * From the secret key, get the W3C XML Encryption URL
+ * @param secretKey
+ * @param keySize
+ * @return
+ */
+ private static String getXMLEncryptionURL(String algo, int keySize)
+ {
+ if("AES".equals(algo))
+ {
+ switch(keySize)
+ {
+ case 192: return XMLCipher.AES_192;
+ case 256: return XMLCipher.AES_256;
+ default:
+ return XMLCipher.AES_128;
+ }
+ }
+ if(algo.contains("RSA"))
+ return XMLCipher.RSA_v1dot5;
+ if(algo.contains("DES"))
+ return XMLCipher.TRIPLEDES_KeyWrap;
+ throw new IllegalArgumentException("Secret Key with unsupported algo:" + algo);
+ }
+
+ /**
+ * Returns the next Element node.
+ */
+ private static Element getNextElementNode(Node node)
+ {
+ while(node != null)
+ {
+ if(Node.ELEMENT_NODE == node.getNodeType())
+ return (Element) node;
+ node = node.getNextSibling();
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-model/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-fed-model/pom.xml 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-fed-model/pom.xml 2009-05-26 15:43:37 UTC (rev 536)
@@ -58,10 +58,6 @@
<artifactId>log4j</artifactId>
</dependency>
<dependency>
- <groupId>org.apache</groupId>
- <artifactId>xmlsec</artifactId>
- </dependency>
- <dependency>
<groupId>apache-logging</groupId>
<artifactId>commons-logging-api</artifactId>
</dependency>
Deleted: identity-federation/trunk/jboss-identity-xmlsec-model/src/main/java/org/jboss/identity/xmlsec/util/XMLEncryptionUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-xmlsec-model/src/main/java/org/jboss/identity/xmlsec/util/XMLEncryptionUtil.java 2009-05-26 15:25:25 UTC (rev 535)
+++ identity-federation/trunk/jboss-identity-xmlsec-model/src/main/java/org/jboss/identity/xmlsec/util/XMLEncryptionUtil.java 2009-05-26 15:43:37 UTC (rev 536)
@@ -1,396 +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.xmlsec.util;
-
-import java.security.Key;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import javax.crypto.SecretKey;
-import javax.xml.namespace.QName;
-
-import org.apache.xml.security.encryption.EncryptedData;
-import org.apache.xml.security.encryption.EncryptedKey;
-import org.apache.xml.security.encryption.XMLCipher;
-import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * XML Encryption Util
- * <b>Note: </b> This utility is currently using Apache XML Security
- * library API. JSR-106 is not yet final. Until that happens,we
- * rely on the non-standard API.
- *
- * @author Anil.Saldhana(a)redhat.com
- * @since Feb 4, 2009
- */
-public class XMLEncryptionUtil
-{
- public static final String CIPHER_DATA_LOCALNAME = "CipherData";
- public static final String ENCRYPTED_KEY_LOCALNAME = "EncryptedKey";
- public static final String DS_KEY_INFO = "ds:KeyInfo";
-
- public static final String XMLNS = "http://www.w3.org/2000/xmlns/";
- public static String XMLSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
- public static String XMLENC_NS = "http://www.w3.org/2001/04/xmlenc#";
-
- static
- {
- //Initialize the Apache XML Security Library
- org.apache.xml.security.Init.init();
- }
-
- /**
- * <p>
- * Encrypt the Key to be transported
- * </p>
- * <p>
- * Data is encrypted with a SecretKey. Then the key needs to be
- * transported to the other end where it is needed for decryption.
- * For the Key transport, the SecretKey is encrypted with the
- * recipient's public key. At the receiving end, the receiver
- * can decrypt the Secret Key using his private key.s
- * </p>
- * @param document
- * @param keyToBeEncrypted Symmetric Key (SecretKey)
- * @param keyUsedToEncryptSecretKey Asymmetric Key (Public Key)
- * @param keySize Length of the key
- * @return
- * @throws XMLSecurityException
- */
- public static EncryptedKey encryptKey(Document document,
- SecretKey keyToBeEncrypted, PublicKey keyUsedToEncryptSecretKey,
- int keySize) throws XMLSecurityException
- {
- XMLCipher keyCipher = null;
- String pubKeyAlg = keyUsedToEncryptSecretKey.getAlgorithm();
-
- String keyWrapAlgo = getXMLEncryptionURLForKeyUnwrap(pubKeyAlg, keySize);
- keyCipher = XMLCipher.getInstance(keyWrapAlgo);
-
- keyCipher.init(XMLCipher.WRAP_MODE, keyUsedToEncryptSecretKey);
- return keyCipher.encryptKey(document, keyToBeEncrypted);
- }
-
- /**
- * Given an element in a Document, encrypt the element and replace
- * the element in the document with the encrypted data
- * @param elementQName QName of the element that we like to encrypt
- * @param publicKey
- * @param secretKey
- * @param keySize
- * @param wrappingElementQName A QName of an element that will wrap the encrypted element
- * @param addEncryptedKeyInKeyInfo Need for the EncryptedKey to be placed in ds:KeyInfo
- * @return
- * @throws Exception
- */
- public static void encryptElement(QName elementQName,
- Document document,
- PublicKey publicKey,
- SecretKey secretKey, int keySize, QName wrappingElementQName,
- boolean addEncryptedKeyInKeyInfo) throws Exception
- {
- if(elementQName == null)
- throw new IllegalArgumentException("elementQName is null");
- if(document == null)
- throw new IllegalArgumentException("document is null");
- String wrappingElementPrefix = wrappingElementQName.getPrefix();
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
- throw new IllegalArgumentException("Wrapping element prefix invalid");
-
- NodeList elements = document.getElementsByTagName(elementQName.toString());
- if(elements == null || elements.getLength() > 1)
- throw new IllegalStateException("Element was either null or more than one:"+elements);
- Element documentElement = (Element) elements.item(0);
-
- if(documentElement == null)
- throw new IllegalStateException("Element could not be found in the document:"+ elementQName.toString());
-
- XMLCipher cipher = null;
- EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
-
- String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
- //Encrypt the Document
- cipher = XMLCipher.getInstance(encryptionAlgorithm);
- cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
-
- Document encryptedDoc = cipher.doFinal(document, documentElement);
-
- // The EncryptedKey element is added
- Element encryptedKeyElement = cipher.martial(document, encryptedKey);
-
- String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
-
- //Create the wrapping element and set its attribute NS
- Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
- wrappingElementName);
-
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
- {
- wrappingElementName = wrappingElementQName.getLocalPart();
- }
- wrappingElement.setAttributeNS(XMLNS,
- "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
-
- //Get Hold of the Cipher Data
- NodeList cipherElements = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, "EncryptedData");
- if(cipherElements == null || cipherElements.getLength() == 0)
- throw new IllegalStateException("xenc:EncryptedData Element Missing");
- Element encryptedDataElement = (Element) cipherElements.item(0);
-
- Node parentOfEncNode = encryptedDataElement.getParentNode();
- parentOfEncNode.replaceChild(wrappingElement, encryptedDataElement);
-
- wrappingElement.appendChild(encryptedDataElement);
-
- if (addEncryptedKeyInKeyInfo)
- {
- // Outer ds:KeyInfo Element to hold the EncryptionKey
- Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
- sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
- sigElement.appendChild(encryptedKeyElement);
-
- //Insert the Encrypted key before the CipherData element
- NodeList nodeList = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
- if (nodeList == null || nodeList.getLength() == 0)
- throw new IllegalStateException("xenc:CipherData Element Missing");
- Element cipherDataElement = (Element) nodeList.item(0);
- Node cipherParent = cipherDataElement.getParentNode();
- cipherParent.insertBefore(sigElement, cipherDataElement);
- }
- else
- {
- //Add the encrypted key as a child of the wrapping element
- wrappingElement.appendChild(encryptedKeyElement);
- }
- }
-
-
- /**
- * Encrypt the root document element inside a Document.
- * <b>NOTE:</> The document root element will be replaced
- * by the wrapping element.
- *
- * @param document Document that contains an element to encrypt
- * @param publicKey The Public Key used to encrypt the secret encryption key
- * @param secretKey The secret encryption key
- * @param keySize Length of key
- * @param wrappingElementQName QName of the element to be used to wrap around
- * the cipher data.
- * @param addEncryptedKeyInKeyInfo Should the encrypted key be inside a KeyInfo
- * or added as a peer of Cipher Data
- * @return An element that has the wrappingElementQName
- * @throws Exception
- */
- public static Element encryptElementInDocument(Document document,
- PublicKey publicKey,
- SecretKey secretKey, int keySize, QName wrappingElementQName,
- boolean addEncryptedKeyInKeyInfo) throws Exception
- {
- String wrappingElementPrefix = wrappingElementQName.getPrefix();
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
- throw new IllegalArgumentException("Wrapping element prefix invalid");
-
- XMLCipher cipher = null;
- EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
-
- String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
- //Encrypt the Document
- cipher = XMLCipher.getInstance(encryptionAlgorithm);
- cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
-
- Document encryptedDoc = cipher.doFinal(document, document.getDocumentElement());
-
- // The EncryptedKey element is added
- Element encryptedKeyElement = cipher.martial(document, encryptedKey);
-
- String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
-
- //Create the wrapping element and set its attribute NS
- Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
- wrappingElementName);
-
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
- {
- wrappingElementName = wrappingElementQName.getLocalPart();
- }
- wrappingElement.setAttributeNS(XMLNS,
- "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
-
- Element encryptedDocRootElement = encryptedDoc.getDocumentElement();
- //Bring in the encrypted wrapping element to wrap the root node
- encryptedDoc.replaceChild(wrappingElement, encryptedDocRootElement);
-
- wrappingElement.appendChild(encryptedDocRootElement);
-
- if (addEncryptedKeyInKeyInfo)
- {
- // Outer ds:KeyInfo Element to hold the EncryptionKey
- Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
- sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
- sigElement.appendChild(encryptedKeyElement);
-
- //Insert the Encrypted key before the CipherData element
- NodeList nodeList = encryptedDocRootElement.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
- if (nodeList == null || nodeList.getLength() == 0)
- throw new IllegalStateException("xenc:CipherData Element Missing");
-
- Element cipherDataElement = (Element) nodeList.item(0);
- encryptedDocRootElement.insertBefore(sigElement, cipherDataElement);
- }
- else
- {
- //Add the encrypted key as a child of the wrapping element
- wrappingElement.appendChild(encryptedKeyElement);
- }
-
- return encryptedDoc.getDocumentElement();
- }
-
- /**
- * Decrypt an encrypted element inside a document
- * @param documentWithEncryptedElement
- * @param privateKey key need to unwrap the encryption key
- * @return the document with the encrypted element replaced by the data element
- * @throws Exception
- */
- public static Element decryptElementInDocument(Document documentWithEncryptedElement,
- PrivateKey privateKey) throws Exception
- {
- if(documentWithEncryptedElement == null)
- throw new IllegalArgumentException("Input document is null");
-
- //Look for encrypted data element
- Element documentRoot = documentWithEncryptedElement.getDocumentElement();
- Element encDataElement = getNextElementNode(documentRoot.getFirstChild());
- if(encDataElement == null)
- throw new IllegalStateException("No element representing the encrypted data found");
-
- //Look at siblings for the key
- Element encKeyElement = getNextElementNode(encDataElement.getNextSibling());
- if(encKeyElement == null)
- {
- //Search the enc data element for enc key
- NodeList nodeList = encDataElement.getElementsByTagNameNS( XMLENC_NS, ENCRYPTED_KEY_LOCALNAME);
-
- if(nodeList == null || nodeList.getLength() == 0)
- throw new IllegalStateException("Encrypted Key not found in the enc data");
-
- encKeyElement = (Element) nodeList.item(0);
- }
-
- XMLCipher cipher = XMLCipher.getInstance();
- cipher.init(XMLCipher.DECRYPT_MODE, null);
- EncryptedData encryptedData = cipher.loadEncryptedData(documentWithEncryptedElement, encDataElement);
- EncryptedKey encryptedKey = cipher.loadEncryptedKey(documentWithEncryptedElement, encKeyElement);
-
- Document decryptedDoc = null;
-
- if (encryptedData != null && encryptedKey != null)
- {
- String encAlgoURL = encryptedData.getEncryptionMethod().getAlgorithm();
- XMLCipher keyCipher = XMLCipher.getInstance();
- keyCipher.init(XMLCipher.UNWRAP_MODE, privateKey);
- Key encryptionKey = keyCipher.decryptKey( encryptedKey, encAlgoURL );
- cipher = XMLCipher.getInstance();
- cipher.init(XMLCipher.DECRYPT_MODE, encryptionKey);
- decryptedDoc = cipher.doFinal(documentWithEncryptedElement, encDataElement);
- }
-
- Element decryptedRoot = decryptedDoc.getDocumentElement();
- Element dataElement = getNextElementNode(decryptedRoot.getFirstChild());
- if (dataElement == null)
- throw new IllegalStateException("Data Element after encryption is null");
-
- decryptedRoot.removeChild(dataElement);
- decryptedDoc.replaceChild(dataElement, decryptedRoot);
-
- return decryptedDoc.getDocumentElement();
- }
-
- /**
- * From the secret key, get the W3C XML Encryption URL
- * @param publicKeyAlgo
- * @param keySize
- * @return
- */
- private static String getXMLEncryptionURLForKeyUnwrap(String publicKeyAlgo, int keySize)
- {
- if("AES".equals(publicKeyAlgo))
- {
- switch(keySize)
- {
- case 192: return XMLCipher.AES_192_KeyWrap;
- case 256: return XMLCipher.AES_256_KeyWrap;
- default:
- return XMLCipher.AES_128_KeyWrap;
- }
- }
- if(publicKeyAlgo.contains("RSA"))
- return XMLCipher.RSA_v1dot5;
- if(publicKeyAlgo.contains("DES"))
- return XMLCipher.TRIPLEDES_KeyWrap;
- throw new IllegalArgumentException("unsupported publicKey Algo:" + publicKeyAlgo);
- }
-
- /**
- * From the secret key, get the W3C XML Encryption URL
- * @param secretKey
- * @param keySize
- * @return
- */
- private static String getXMLEncryptionURL(String algo, int keySize)
- {
- if("AES".equals(algo))
- {
- switch(keySize)
- {
- case 192: return XMLCipher.AES_192;
- case 256: return XMLCipher.AES_256;
- default:
- return XMLCipher.AES_128;
- }
- }
- if(algo.contains("RSA"))
- return XMLCipher.RSA_v1dot5;
- if(algo.contains("DES"))
- return XMLCipher.TRIPLEDES_KeyWrap;
- throw new IllegalArgumentException("Secret Key with unsupported algo:" + algo);
- }
-
- /**
- * Returns the next Element node.
- */
- private static Element getNextElementNode(Node node)
- {
- while(node != null)
- {
- if(Node.ELEMENT_NODE == node.getNodeType())
- return (Element) node;
- node = node.getNextSibling();
- }
- return null;
- }
-}
\ No newline at end of file
15 years, 7 months
JBoss Identity SVN: r535 - in identity-federation/trunk: jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config and 6 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-26 11:25:25 -0400 (Tue, 26 May 2009)
New Revision: 535
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/JAXBUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/SecurityActions.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/util/ValveUtil.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/KeyUtil.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnRequestFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLBaseFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java
Log:
JBID-120: use a central util for JAXB
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/util/ValveUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/util/ValveUtil.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/util/ValveUtil.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -35,7 +35,7 @@
import org.jboss.identity.federation.bindings.config.IDPType;
import org.jboss.identity.federation.bindings.config.SPType;
import org.jboss.identity.federation.core.constants.JBossIdentityFederationConstants;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.xml.sax.SAXException;
/**
@@ -108,9 +108,9 @@
String pkgName = "org.jboss.identity.federation.bindings.config";
Unmarshaller un = null;
if(validate)
- un = JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schema);
+ un = JAXBUtil.getValidatingUnmarshaller(pkgName, schema);
else
- un = JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ un = JAXBUtil.getUnmarshaller(pkgName);
JAXBElement<IDPType> jaxbSp = (JAXBElement<IDPType>) un.unmarshal(is);
return jaxbSp.getValue();
@@ -129,9 +129,9 @@
String pkgName = "org.jboss.identity.federation.bindings.config";
Unmarshaller un = null;
if(validate)
- un = JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schema);
+ un = JAXBUtil.getValidatingUnmarshaller(pkgName, schema);
else
- un = JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ un = JAXBUtil.getUnmarshaller(pkgName);
JAXBElement<SPType> jaxbSp = (JAXBElement<SPType>) un.unmarshal(is);
return jaxbSp.getValue();
Modified: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -40,7 +40,7 @@
import org.jboss.identity.federation.bindings.config.TokenProviderType;
import org.jboss.identity.federation.bindings.config.TokenProvidersType;
import org.jboss.identity.federation.bindings.config.TrustType;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
/**
* Unit Test the various config
@@ -174,7 +174,7 @@
InputStream is = tcl.getResourceAsStream(configFile);
assertNotNull("Inputstream not null", is);
- Unmarshaller un = JBossSAMLBaseFactory.getValidatingUnmarshaller("org.jboss.identity.federation.bindings.config",
+ Unmarshaller un = JAXBUtil.getValidatingUnmarshaller("org.jboss.identity.federation.bindings.config",
schema);
return un.unmarshal(is);
}
Modified: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -33,7 +33,7 @@
import org.jboss.identity.federation.bindings.config.KeyValueType;
import org.jboss.identity.federation.bindings.config.MetadataProviderType;
import org.jboss.identity.federation.bindings.config.TrustType;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
/**
@@ -81,7 +81,7 @@
assertNotNull("Inputstream not null", is);
Unmarshaller un =
- JBossSAMLBaseFactory.getValidatingUnmarshaller("org.jboss.identity.federation.bindings.config",
+ JAXBUtil.getValidatingUnmarshaller("org.jboss.identity.federation.bindings.config",
schema);
return un.unmarshal(is);
}
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -28,7 +28,7 @@
import javax.xml.bind.Unmarshaller;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
import org.jboss.identity.federation.saml.v2.metadata.EndpointType;
import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
@@ -180,7 +180,7 @@
*/
public static Marshaller getMarshaller() throws JAXBException
{
- return JBossSAMLBaseFactory.getMarshaller(pkgName);
+ return JAXBUtil.getMarshaller(pkgName);
}
/**
@@ -190,7 +190,7 @@
*/
public static Unmarshaller getUnmarshaller() throws JAXBException
{
- return JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ return JAXBUtil.getUnmarshaller(pkgName);
}
/**
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/KeyUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/KeyUtil.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/KeyUtil.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -34,7 +34,7 @@
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory;
@@ -109,7 +109,7 @@
*/
public static Unmarshaller getUnmarshaller() throws JAXBException
{
- return JBossSAMLBaseFactory.getUnmarshaller("org.jboss.identity.xmlsec.w3.xmldsig");
+ return JAXBUtil.getUnmarshaller("org.jboss.identity.xmlsec.w3.xmldsig");
}
/**
@@ -119,7 +119,7 @@
*/
public static Marshaller getMarshaller() throws JAXBException
{
- return JBossSAMLBaseFactory.getMarshaller("org.jboss.identity.xmlsec.w3.xmldsig");
+ return JAXBUtil.getMarshaller("org.jboss.identity.xmlsec.w3.xmldsig");
}
/**
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/util/XMLSignatureUtil.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -53,7 +53,7 @@
import javax.xml.transform.stream.StreamResult;
import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
import org.jboss.identity.xmlsec.w3.xmldsig.ObjectFactory;
@@ -231,7 +231,7 @@
public static void marshall(SignatureType signature, OutputStream os) throws Exception
{
JAXBElement<SignatureType> jsig = objectFactory.createSignature(signature);
- Marshaller marshaller = JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
+ Marshaller marshaller = JAXBUtil.getValidatingMarshaller(pkgName, schemaLocation);
marshaller.marshal(jsig, os);
}
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnRequestFactory.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnRequestFactory.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnRequestFactory.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -30,6 +30,7 @@
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
import org.jboss.identity.federation.core.saml.v2.util.XMLTimeUtil;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.assertion.NameIDType;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.xml.sax.SAXException;
@@ -104,9 +105,9 @@
public static Marshaller getValidatingMarshaller(boolean schemaValidation) throws SAXException, JAXBException
{
if(schemaValidation)
- return JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
+ return JAXBUtil.getValidatingMarshaller(pkgName, schemaLocation);
else
- return JBossSAMLBaseFactory.getMarshaller(pkgName);
+ return JAXBUtil.getMarshaller(pkgName);
}
/**
@@ -119,8 +120,8 @@
public static Unmarshaller getValidatingUnmarshaller(boolean schemaValidation) throws JAXBException, SAXException
{
if(schemaValidation)
- return JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
+ return JAXBUtil.getValidatingUnmarshaller(pkgName, schemaLocation);
else
- return JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ return JAXBUtil.getUnmarshaller(pkgName);
}
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -32,6 +32,7 @@
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.util.XMLTimeUtil;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
import org.jboss.identity.federation.saml.v2.assertion.NameIDType;
import org.jboss.identity.federation.saml.v2.assertion.SubjectConfirmationDataType;
@@ -181,7 +182,7 @@
*/
public static Marshaller getValidatingMarshaller() throws SAXException, JAXBException
{
- return JBossSAMLBaseFactory.getValidatingMarshaller(pkgName, schemaLocation);
+ return JAXBUtil.getValidatingMarshaller(pkgName, schemaLocation);
}
/**
@@ -192,6 +193,6 @@
*/
public static Unmarshaller getValidatingUnmarshaller() throws JAXBException, SAXException
{
- return JBossSAMLBaseFactory.getValidatingUnmarshaller(pkgName, schemaLocation);
+ return JAXBUtil.getValidatingUnmarshaller(pkgName, schemaLocation);
}
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLBaseFactory.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLBaseFactory.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/JBossSAMLBaseFactory.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -21,16 +21,9 @@
*/
package org.jboss.identity.federation.core.saml.v2.factories;
-import java.net.URL;
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
import javax.xml.datatype.XMLGregorianCalendar;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
@@ -41,7 +34,6 @@
import org.jboss.identity.federation.saml.v2.assertion.SubjectConfirmationDataType;
import org.jboss.identity.federation.saml.v2.assertion.SubjectConfirmationType;
import org.jboss.identity.federation.saml.v2.assertion.SubjectType;
-import org.xml.sax.SAXException;
/**
* Base methods for the factories
@@ -51,9 +43,7 @@
public class JBossSAMLBaseFactory
{
private static ObjectFactory assertionObjectFactory = new ObjectFactory();
-
- public static final String W3C_XML_SCHEMA_NS_URI = "http://www.w3.org/2001/XMLSchema";
-
+
/**
* Create a plain assertion type
* @return
@@ -205,84 +195,4 @@
nid.setValue(issuerID);
return nid;
}
-
- /**
- * Get the JAXB Marshaller
- * @param pkgName The package name for the jaxb context
- * @return Marshaller
- * @throws JAXBException
- */
- public static Marshaller getMarshaller(String pkgName) throws JAXBException
- {
- if(pkgName == null)
- throw new IllegalArgumentException("pkgName is null");
-
- JAXBContext jc = JAXBContext.newInstance(pkgName);
- Marshaller marshaller = jc.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- return marshaller;
- }
-
- /**
- * Get the JAXB Marshaller
- * @param pkgName The package name for the jaxb context
- * @param schemaLocation location of the schema to validate against
- * @return Marshaller
- * @throws JAXBException
- * @throws SAXException
- */
- public static Marshaller getValidatingMarshaller(String pkgName, String schemaLocation)
- throws JAXBException, SAXException
- {
- Marshaller marshaller = getMarshaller(pkgName);
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- //Validate against schema
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- URL schemaURL = tcl.getResource(schemaLocation);
- if(schemaURL == null)
- throw new IllegalStateException("Schema URL is null:" + schemaLocation);
- SchemaFactory scFact = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
- Schema schema = scFact.newSchema(schemaURL);
- marshaller.setSchema(schema);
-
- return marshaller;
- }
-
- /**
- * Get the JAXB Unmarshaller
- * @param pkgName The package name for the jaxb context
- * @return unmarshaller
- * @throws JAXBException
- */
- public static Unmarshaller getUnmarshaller(String pkgName) throws JAXBException
- {
- if(pkgName == null)
- throw new IllegalArgumentException("pkgName is null");
- JAXBContext jc = JAXBContext.newInstance(pkgName);
- return jc.createUnmarshaller();
- }
-
- /**
- * Get the JAXB Unmarshaller
- * @param pkgName The package name for the jaxb context
- * @param schemaLocation location of the schema to validate against
- * @return unmarshaller
- * @throws JAXBException
- * @throws SAXException
- */
- public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation)
- throws JAXBException, SAXException
- {
- Unmarshaller unmarshaller = getUnmarshaller(pkgName);
- //Validate against schema
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- URL schemaURL = tcl.getResource(schemaLocation);
- if(schemaURL == null)
- throw new IllegalStateException("Schema URL is null:" + schemaLocation);
- SchemaFactory scFact = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
- Schema schema = scFact.newSchema(schemaURL);
- unmarshaller.setSchema(schema);
-
- return unmarshaller;
- }
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -35,7 +35,7 @@
import javax.xml.bind.Unmarshaller;
import org.apache.log4j.Logger;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
import org.jboss.identity.federation.saml.v2.metadata.ObjectFactory;
@@ -81,7 +81,7 @@
Unmarshaller un;
try
{
- un = JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ un = JAXBUtil.getUnmarshaller(pkgName);
JAXBElement<EntityDescriptorType> je =
(JAXBElement<EntityDescriptorType>) un.unmarshal(persistedFile);
return je.getValue();
@@ -109,7 +109,7 @@
Marshaller m;
try
{
- m = JBossSAMLBaseFactory.getMarshaller(pkgName);
+ m = JAXBUtil.getMarshaller(pkgName);
m.marshal(jentity, persistedFile);
}
catch (JAXBException e)
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/JAXBUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/JAXBUtil.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/JAXBUtil.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -0,0 +1,124 @@
+/*
+ * 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.util;
+
+import java.net.URL;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.xml.sax.SAXException;
+
+/**
+ * Utility to obtain JAXB2 marshaller/unmarshaller etc
+ * @author Anil.Saldhana(a)redhat.com
+ * @since May 26, 2009
+ */
+public class JAXBUtil
+{
+ public static final String W3C_XML_SCHEMA_NS_URI = "http://www.w3.org/2001/XMLSchema";
+
+
+ /**
+ * Get the JAXB Marshaller
+ * @param pkgName The package name for the jaxb context
+ * @param schemaLocation location of the schema to validate against
+ * @return Marshaller
+ * @throws JAXBException
+ * @throws SAXException
+ */
+ public static Marshaller getValidatingMarshaller(String pkgName, String schemaLocation)
+ throws JAXBException, SAXException
+ {
+ Marshaller marshaller = JAXBUtil.getMarshaller(pkgName);
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ //Validate against schema
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ URL schemaURL = tcl.getResource(schemaLocation);
+ if(schemaURL == null)
+ throw new IllegalStateException("Schema URL is null:" + schemaLocation);
+ SchemaFactory scFact = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
+ Schema schema = scFact.newSchema(schemaURL);
+ marshaller.setSchema(schema);
+
+ return marshaller;
+ }
+
+ /**
+ * Get the JAXB Marshaller
+ * @param pkgName The package name for the jaxb context
+ * @return Marshaller
+ * @throws JAXBException
+ */
+ public static Marshaller getMarshaller(String pkgName) throws JAXBException
+ {
+ if(pkgName == null)
+ throw new IllegalArgumentException("pkgName is null");
+
+ JAXBContext jc = JAXBContext.newInstance(pkgName);
+ Marshaller marshaller = jc.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ return marshaller;
+ }
+
+ /**
+ * Get the JAXB Unmarshaller
+ * @param pkgName The package name for the jaxb context
+ * @return unmarshaller
+ * @throws JAXBException
+ */
+ public static Unmarshaller getUnmarshaller(String pkgName) throws JAXBException
+ {
+ if(pkgName == null)
+ throw new IllegalArgumentException("pkgName is null");
+ JAXBContext jc = JAXBContext.newInstance(pkgName);
+ return jc.createUnmarshaller();
+ }
+
+ /**
+ * Get the JAXB Unmarshaller
+ * @param pkgName The package name for the jaxb context
+ * @param schemaLocation location of the schema to validate against
+ * @return unmarshaller
+ * @throws JAXBException
+ * @throws SAXException
+ */
+ public static Unmarshaller getValidatingUnmarshaller(String pkgName, String schemaLocation)
+ throws JAXBException, SAXException
+ {
+ Unmarshaller unmarshaller = getUnmarshaller(pkgName);
+ //Validate against schema
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ URL schemaURL = tcl.getResource(schemaLocation);
+ if(schemaURL == null)
+ throw new IllegalStateException("Schema URL is null:" + schemaLocation);
+ SchemaFactory scFact = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
+ Schema schema = scFact.newSchema(schemaURL);
+ unmarshaller.setSchema(schema);
+
+ return unmarshaller;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/SecurityActions.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/SecurityActions.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -0,0 +1,65 @@
+/*
+ * 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.util;
+
+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();
+ }
+ });
+ }
+
+ /**
+ * Get the system property
+ * @param key
+ * @param defaultValue
+ * @return
+ */
+ static String getSystemProperty(final String key, final String defaultValue)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(key, defaultValue);
+ }
+ });
+ }
+}
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java 2009-05-26 15:09:14 UTC (rev 534)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java 2009-05-26 15:25:25 UTC (rev 535)
@@ -28,8 +28,8 @@
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
-import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
import org.jboss.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
+import org.jboss.identity.federation.core.util.JAXBUtil;
import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
import junit.framework.TestCase;
@@ -53,7 +53,7 @@
tcl.getResourceAsStream("saml2/metadata/idp-entitydescriptor.xml");
assertNotNull("Inputstream not null", is);
- Unmarshaller un = JBossSAMLBaseFactory.getUnmarshaller(pkgName);
+ Unmarshaller un = JAXBUtil.getUnmarshaller(pkgName);
JAXBElement<EntityDescriptorType> je = (JAXBElement<EntityDescriptorType>) un.unmarshal(is);
EntityDescriptorType edt = je.getValue();
assertNotNull("EntityDescriptorType not null", edt);
15 years, 7 months
JBoss Identity SVN: r534 - in identity-federation/trunk/jboss-identity-webapps: employee and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-26 11:09:14 -0400 (Tue, 26 May 2009)
New Revision: 534
Modified:
identity-federation/trunk/jboss-identity-webapps/employee/pom.xml
identity-federation/trunk/jboss-identity-webapps/pom.xml
identity-federation/trunk/jboss-identity-webapps/sales/pom.xml
Log:
correct names
Modified: identity-federation/trunk/jboss-identity-webapps/employee/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/employee/pom.xml 2009-05-26 15:06:57 UTC (rev 533)
+++ identity-federation/trunk/jboss-identity-webapps/employee/pom.xml 2009-05-26 15:09:14 UTC (rev 534)
@@ -1,10 +1,10 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.federation</groupId>
- <artifactId>jboss-identity-samples-employee</artifactId>
+ <artifactId>jboss-identity-webapps-employee</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
- <name>JBoss Identity Federation Samples Employee</name>
+ <name>JBoss Identity Federation Web Apps Employee</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity samples contains the samples for Federated Identity Needs.</description>
<licenses>
Modified: identity-federation/trunk/jboss-identity-webapps/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/pom.xml 2009-05-26 15:06:57 UTC (rev 533)
+++ identity-federation/trunk/jboss-identity-webapps/pom.xml 2009-05-26 15:09:14 UTC (rev 534)
@@ -6,11 +6,11 @@
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-identity-samples</artifactId>
+ <artifactId>jboss-identity-webapps</artifactId>
<packaging>pom</packaging>
- <name>JBoss Identity Federation Samples</name>
+ <name>JBoss Identity Federation Web Applications</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Identity Samples contains the samples for Federated Identity Needs.</description>
+ <description>JBoss Identity Web Applications contains the web applications for Federated Identity Needs.</description>
<licenses>
<license>
<name>lgpl</name>
Modified: identity-federation/trunk/jboss-identity-webapps/sales/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/sales/pom.xml 2009-05-26 15:06:57 UTC (rev 533)
+++ identity-federation/trunk/jboss-identity-webapps/sales/pom.xml 2009-05-26 15:09:14 UTC (rev 534)
@@ -1,10 +1,10 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.federation</groupId>
- <artifactId>jboss-identity-samples-sales</artifactId>
+ <artifactId>jboss-identity-webapps-sales</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
- <name>JBoss Identity Federation Samples - Sales</name>
+ <name>JBoss Identity Federation Sales</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity Samples contains the samples for Federated Identity Needs.</description>
<licenses>
15 years, 7 months
JBoss Identity SVN: r533 - identity-federation/trunk.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-26 11:06:57 -0400 (Tue, 26 May 2009)
New Revision: 533
Added:
identity-federation/trunk/jboss-identity-webapps/
Removed:
identity-federation/trunk/jboss-identity-samples/
Log:
rename samples workspace to webapps
Copied: identity-federation/trunk/jboss-identity-webapps (from rev 532, identity-federation/trunk/jboss-identity-samples)
15 years, 7 months
JBoss Identity SVN: r532 - identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-05-26 11:05:16 -0400 (Tue, 26 May 2009)
New Revision: 532
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java
Log:
priv block
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java 2009-05-25 13:25:00 UTC (rev 531)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java 2009-05-26 15:05:16 UTC (rev 532)
@@ -156,7 +156,7 @@
protected STSConfiguration getConfiguration()
{
// get the configuration file and parse it.
- URL configurationFile = Thread.currentThread().getContextClassLoader().getResource("jboss-sts.xml");
+ URL configurationFile = SecurityActions.getContextClassLoader().getResource("jboss-sts.xml");
if (configurationFile == null)
return new JBossSTSConfiguration();
15 years, 7 months
JBoss Identity SVN: r531 - in identity-federation/trunk: jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-05-25 09:25:00 -0400 (Mon, 25 May 2009)
New Revision: 531
Added:
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SAML20TokenProvider.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardSecurityToken.java
identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/SAML20TokenProviderUnitTestCase.java
Modified:
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardRequestHandler.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java
identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/WSTrustJAXBFactoryUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenCollectionType.java
identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseCollectionType.java
identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseType.java
identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenType.java
Log:
JBID-84: Added a SAML 2.0 token provider that issues unsigned SAML token assertions.
Added: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SAML20TokenProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SAML20TokenProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SAML20TokenProvider.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.wstrust;
+
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.UUID;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+
+import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
+import org.jboss.identity.federation.saml.v2.assertion.AudienceRestrictionType;
+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.ObjectFactory;
+import org.jboss.identity.federation.saml.v2.assertion.SubjectConfirmationType;
+import org.jboss.identity.federation.saml.v2.assertion.SubjectType;
+import org.jboss.identity.federation.ws.policy.AppliesTo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
+
+/**
+ * <p>
+ * A {@code SecurityTokenProvider} implementation that handles WS-Trust SAML 2.0 token requests.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class SAML20TokenProvider implements SecurityTokenProvider
+{
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.identity.federation.api.wstrust.SecurityTokenProvider#cancelToken(org.jboss.identity.federation.api.wstrust.WSTrustRequestContext)
+ */
+ public void cancelToken(WSTrustRequestContext context) throws WSTrustException
+ {
+ // TODO: implement cancel logic.
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.identity.federation.api.wstrust.SecurityTokenProvider#issueToken(org.jboss.identity.federation.api.wstrust.WSTrustRequestContext)
+ */
+ public void issueToken(WSTrustRequestContext context) throws WSTrustException
+ {
+ // generate an id for the new assertion.
+ String assertionID = "ID-" + UUID.randomUUID().toString();
+
+ // lifetime and audience restrictions.
+ GregorianCalendar[] lifetime = WSTrustUtil.parseLifetime(context.getRequestSecurityToken().getLifetime());
+ List<AudienceRestrictionType> audienceRestrictions = null;
+ AppliesTo appliesTo = context.getRequestSecurityToken().getAppliesTo();
+ if (appliesTo != null)
+ {
+ AudienceRestrictionType restriction = new AudienceRestrictionType();
+ restriction.getAudience().add(WSTrustUtil.parseAppliesTo(appliesTo));
+ audienceRestrictions = new ArrayList<AudienceRestrictionType>();
+ audienceRestrictions.add(restriction);
+ }
+ ConditionsType conditions = this.createConditions(lifetime[0], lifetime[1], audienceRestrictions);
+
+ // TODO: implement support for the other confirmation methods.
+ String confirmationMethod = "urn:oasis:names:tc:SAML:2.0:cm:bearer";
+ SubjectConfirmationType subjectConfirmation = new SubjectConfirmationType();
+ subjectConfirmation.setMethod(confirmationMethod);
+
+ // create a subject using the caller principal.
+ NameIDType nameID = new NameIDType();
+ nameID.setValue(context.getCallerPrincipal().getName());
+ nameID.setNameQualifier("http://www.jboss.org");
+ SubjectType subject = new SubjectType();
+ ObjectFactory factory = new ObjectFactory();
+ subject.getContent().add(factory.createNameID(nameID));
+ subject.getContent().add(factory.createSubjectConfirmation(subjectConfirmation));
+
+ // TODO: add SAML statements that corresponds to the claims provided by the requester.
+
+ // generate the SAML assertion.
+ AssertionType assertion = new AssertionType();
+ NameIDType issuerID = new NameIDType();
+ issuerID.setValue(context.getTokenIssuer());
+ assertion.setID(assertionID);
+ assertion.setIssuer(issuerID);
+ assertion.setIssueInstant(this.getXMLCalendar(lifetime[0]));
+ assertion.setConditions(conditions);
+ assertion.setSubject(subject);
+
+ // convert the constructed assertion to element.
+ Document document = null;
+ try
+ {
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ DOMResult result = new DOMResult(document);
+ JAXBContext jaxbContext = JAXBContext.newInstance("org.jboss.identity.federation.saml.v2.assertion");
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapper()
+ {
+ @Override
+ public String getPreferredPrefix(String namespaceURI, String suggestion, boolean requirePrefix)
+ {
+ if("urn:oasis:names:tc:SAML:2.0:assertion".equals(namespaceURI))
+ return "saml2";
+ else if("http://www.w3.org/2001/04/xmlenc#".equals(namespaceURI))
+ return "xenc";
+ else if("http://www.w3.org/2000/09/xmldsig#".equals(namespaceURI))
+ return "ds";
+ else
+ return null;
+ }
+ });
+ marshaller.marshal(factory.createAssertion(assertion), result);
+
+ Element element = (Element) document.getChildNodes().item(0);
+ // TODO: sign the generated SAML assertion.
+
+ SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
+ assertionID, element);
+ context.setSecurityToken(token);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.identity.federation.api.wstrust.SecurityTokenProvider#renewToken(org.jboss.identity.federation.api.wstrust.WSTrustRequestContext)
+ */
+ public void renewToken(WSTrustRequestContext context) throws WSTrustException
+ {
+ // TODO: implement renew logic.
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.identity.federation.api.wstrust.SecurityTokenProvider#validateToken(org.jboss.identity.federation.api.wstrust.WSTrustRequestContext)
+ */
+ public void validateToken(WSTrustRequestContext context) throws WSTrustException
+ {
+ // TODO: implemnent validate logic.
+ }
+
+ /**
+ *
+ * @param created
+ * @param expires
+ * @param restrictions
+ * @return
+ */
+ private ConditionsType createConditions(GregorianCalendar created, GregorianCalendar expires,
+ List<AudienceRestrictionType> restrictions)
+ {
+ ConditionsType conditions = new ConditionsType();
+ conditions.setNotBefore(this.getXMLCalendar(created));
+ conditions.setNotOnOrAfter(this.getXMLCalendar(expires));
+ conditions.getConditionOrAudienceRestrictionOrOneTimeUse().addAll(restrictions);
+ return conditions;
+ }
+
+ /**
+ *
+ * @param calendar
+ * @return
+ */
+ private XMLGregorianCalendar getXMLCalendar(GregorianCalendar calendar)
+ {
+ DatatypeFactory factory = null;
+ try
+ {
+ factory = DatatypeFactory.newInstance();
+ return factory.newXMLGregorianCalendar(calendar);
+ }
+ catch (DatatypeConfigurationException dce)
+ {
+ throw new RuntimeException("Unable to get DatatypeFactory instance", dce);
+ }
+ }
+}
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardRequestHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardRequestHandler.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardRequestHandler.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -87,6 +87,7 @@
{
// create the request context and delegate token generation to the provider.
WSTrustRequestContext requestContext = new WSTrustRequestContext(request, callerPrincipal);
+ requestContext.setTokenIssuer(this.configuration.getSTSName());
if (request.getLifetime() == null && this.configuration.getIssuedTokenTimeout() != 0)
{
// if no lifetime has been specified, use the configured timeout value.
Added: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardSecurityToken.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardSecurityToken.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/StandardSecurityToken.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.wstrust;
+
+import java.util.UUID;
+
+import org.w3c.dom.Element;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class StandardSecurityToken implements SecurityToken
+{
+ private final String tokenType;
+
+ private final String tokenId;
+
+ private final Element token;
+
+ /**
+ *
+ * @param tokenType
+ * @param token
+ */
+ public StandardSecurityToken(String tokenType, Element token)
+ {
+ this(tokenType, UUID.randomUUID().toString(), token);
+ }
+
+ /**
+ *
+ * @param tokenType
+ * @param tokenID
+ * @param token
+ */
+ public StandardSecurityToken(String tokenType, String tokenID, Element token)
+ {
+ this.tokenType = tokenType;
+ this.tokenId = tokenID;
+ this.token = token;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.identity.federation.api.wstrust.SecurityToken#getTokenType()
+ */
+ public String getTokenType()
+ {
+ return this.tokenType;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.identity.federation.api.wstrust.SecurityToken#getTokenValue()
+ */
+ public Object getTokenValue()
+ {
+ return this.token;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getTokenId()
+ {
+ return this.tokenId;
+ }
+}
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -42,6 +42,8 @@
private SecurityToken securityToken;
+ private String tokenIssuer;
+
/**
* <p>
* Creates an instance of {@code WSTrustRequestContext} using the specified request.
@@ -103,4 +105,28 @@
{
this.securityToken = token;
}
+
+ /**
+ * <p>
+ * Obtains the name of the token issuer (security token service name).
+ * </p>
+ *
+ * @return a {@code String} representing the token issuer name.
+ */
+ public String getTokenIssuer()
+ {
+ return tokenIssuer;
+ }
+
+ /**
+ * <p>
+ * Sets the name of the token issuer.
+ * </p>
+ *
+ * @param tokenIssuer a {@code String} representing the token issuer name.
+ */
+ public void setTokenIssuer(String tokenIssuer)
+ {
+ this.tokenIssuer = tokenIssuer;
+ }
}
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -23,6 +23,7 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
@@ -30,7 +31,9 @@
import javax.xml.bind.JAXBElement;
+import org.jboss.identity.federation.ws.addressing.AttributedURIType;
import org.jboss.identity.federation.ws.addressing.EndpointReferenceType;
+import org.jboss.identity.federation.ws.addressing.ObjectFactory;
import org.jboss.identity.federation.ws.policy.AppliesTo;
import org.jboss.identity.federation.ws.trust.LifetimeType;
import org.jboss.identity.federation.ws.wss.utility.AttributedDateTime;
@@ -45,7 +48,27 @@
public class WSTrustUtil
{
+ private static final SimpleDateFormat calendarFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'",
+ Locale.getDefault());
+
/**
+ *
+ * @param endpointURI
+ * @return
+ */
+ public static AppliesTo createAppliesTo(String endpointURI)
+ {
+ AttributedURIType attributedURI = new AttributedURIType();
+ attributedURI.setValue(endpointURI);
+ EndpointReferenceType reference = new EndpointReferenceType();
+ reference.setAddress(attributedURI);
+ AppliesTo appliesTo = new AppliesTo();
+ appliesTo.getAny().add(new ObjectFactory().createEndpointReference(reference));
+
+ return appliesTo;
+ }
+
+ /**
* <p>
* Parses the contents of the {@code AppliesTo} element and returns the address the uniquely identify the service
* provider.
@@ -85,9 +108,7 @@
*/
public static LifetimeType createDefaultLifetime(long tokenTimeout)
{
- long createdTime = getCurrentGMTTime();
- final SimpleDateFormat calendarFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'", Locale
- .getDefault());
+ long createdTime = System.currentTimeMillis();
Calendar calendar = new GregorianCalendar();
calendarFormatter.setTimeZone(calendar.getTimeZone());
@@ -109,22 +130,32 @@
/**
* <p>
- * Obtains the current GMT time in milliseconds.
+ * Parses the specified {@code LifetimeType} instance, returning the 'created' and 'expires' times as
+ * {@code GregorianCalendar} objects.
* </p>
*
- * @return a long representing the current GMT time in milliseconds.
+ * @param lifetime the {@code LifetimeType} instance to be parsed.
+ * @return a {@code GregorianCalendar[]} containing the parsed 'created' and 'expires' times.
*/
- public static long getCurrentGMTTime()
+ public static GregorianCalendar[] parseLifetime(LifetimeType lifetime)
{
- Calendar cal = new GregorianCalendar();
- int offset = cal.get(Calendar.ZONE_OFFSET);
- if (cal.getTimeZone().inDaylightTime(cal.getTime()))
- offset += cal.getTimeZone().getDSTSavings();
+ String createdTime = lifetime.getCreated().getValue();
+ String expiresTime = lifetime.getExpires().getValue();
- // return the UTC/GMT time.
- return cal.getTimeInMillis() - offset;
+ try
+ {
+ GregorianCalendar createdCalendar = new GregorianCalendar();
+ createdCalendar.setTime(calendarFormatter.parse(createdTime));
+ GregorianCalendar expiresCalendar = new GregorianCalendar();
+ expiresCalendar.setTime(calendarFormatter.parse(expiresTime));
+ return new GregorianCalendar[] {createdCalendar, expiresCalendar};
+ }
+ catch (ParseException pe)
+ {
+ throw new IllegalArgumentException("Error parsing lifetime object", pe);
+ }
}
-
+
/**
* <p>
* Utility method for creating URIs without having to deal with the {@code URISyntaxException}.
@@ -139,7 +170,7 @@
{
return new URI(text);
}
- catch(URISyntaxException use)
+ catch (URISyntaxException use)
{
throw new RuntimeException(use);
}
Added: identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/SAML20TokenProviderUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/SAML20TokenProviderUnitTestCase.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/SAML20TokenProviderUnitTestCase.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.wstrust;
+
+import java.net.URI;
+import java.security.Principal;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+
+import org.jboss.identity.federation.api.wstrust.SAML20TokenProvider;
+import org.jboss.identity.federation.api.wstrust.StandardSecurityToken;
+import org.jboss.identity.federation.api.wstrust.WSTrustRequestContext;
+import org.jboss.identity.federation.api.wstrust.WSTrustUtil;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
+import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
+import org.jboss.identity.federation.saml.v2.assertion.AudienceRestrictionType;
+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.SubjectConfirmationType;
+import org.jboss.identity.federation.saml.v2.assertion.SubjectType;
+import org.w3c.dom.Element;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class SAML20TokenProviderUnitTestCase extends TestCase
+{
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testIssueSAMLToken() throws Exception
+ {
+ // create a WSTrustRequestContext with a simple WS-Trust request.
+ RequestSecurityToken request = new RequestSecurityToken();
+ request.setLifetime(WSTrustUtil.createDefaultLifetime(3600000));
+ request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider1"));
+ request.setTokenType(new URI("urn:oasis:names:tc:SAML:2.0:assertion"));
+
+ WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
+ context.setTokenIssuer("JBossSTS");
+
+ // call the SAML token provider and check the generated token.
+ new SAML20TokenProvider().issueToken(context);
+ assertNotNull("Unexpected null security token", context.getSecurityToken());
+
+ JAXBContext jaxbContext = JAXBContext.newInstance("org.jboss.identity.federation.saml.v2.assertion");
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ JAXBElement<?> parsedElement = (JAXBElement<?>) unmarshaller.unmarshal((Element) context.getSecurityToken()
+ .getTokenValue());
+ assertNotNull("Unexpected null element", parsedElement);
+ assertEquals("Unexpected element type", AssertionType.class, parsedElement.getDeclaredType());
+
+ AssertionType assertion = (AssertionType) parsedElement.getValue();
+ StandardSecurityToken securityToken = (StandardSecurityToken) context.getSecurityToken();
+ assertEquals("Unexpected token id", securityToken.getTokenId(), assertion.getID());
+ assertEquals("Unexpected token issuer", "JBossSTS", assertion.getIssuer().getValue());
+
+ // check the contents of the assertion conditions.
+ ConditionsType conditions = assertion.getConditions();
+ assertNotNull("Unexpected null conditions", conditions);
+ assertNotNull("Unexpected null value for NotBefore attribute", conditions.getNotBefore());
+ assertNotNull("Unexpected null value for NotOnOrAfter attribute", conditions.getNotOnOrAfter());
+ assertEquals("Unexpected number of conditions", 1, conditions.getConditionOrAudienceRestrictionOrOneTimeUse()
+ .size());
+ assertTrue("Unexpected condition type",
+ conditions.getConditionOrAudienceRestrictionOrOneTimeUse().get(0) instanceof AudienceRestrictionType);
+ AudienceRestrictionType restrictionType = (AudienceRestrictionType) conditions
+ .getConditionOrAudienceRestrictionOrOneTimeUse().get(0);
+ assertNotNull("Unexpected null audience list", restrictionType.getAudience());
+ assertEquals("Unexpected number of audience elements", 1, restrictionType.getAudience().size());
+ assertEquals("Unexpected audience value", "http://services.testcorp.org/provider1",
+ restrictionType.getAudience().get(0));
+
+ // check the contents of the assertion subject.
+ SubjectType subject = assertion.getSubject();
+ assertNotNull("Unexpected null subject", subject);
+ assertEquals("Unexpected subject content size", 2, subject.getContent().size());
+ JAXBElement<?> content = subject.getContent().get(0);
+ assertEquals("Unexpected content type", NameIDType.class, content.getDeclaredType());
+ NameIDType nameID = (NameIDType) content.getValue();
+ assertEquals("Unexpected name id", "sguilhen", nameID.getValue());
+ content = subject.getContent().get(1);
+ assertEquals("Unexpected content type", SubjectConfirmationType.class, content.getDeclaredType());
+ SubjectConfirmationType confirmation = (SubjectConfirmationType) content.getValue();
+ assertEquals("Unexpected confirmation method", "urn:oasis:names:tc:SAML:2.0:cm:bearer", confirmation.getMethod());
+ }
+
+ /**
+ * <p>
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+ private class TestPrincipal implements Principal
+ {
+ private final String name;
+
+ /**
+ *
+ * @param name
+ */
+ public TestPrincipal(String name)
+ {
+ this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.security.Principal#getName()
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+ }
+}
Modified: identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/WSTrustJAXBFactoryUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/WSTrustJAXBFactoryUnitTestCase.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/WSTrustJAXBFactoryUnitTestCase.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -113,17 +113,6 @@
RequestSecurityTokenCollection parsedCollection = (RequestSecurityTokenCollection) baseRequest;
assertNotNull("Unexpected null request list", parsedCollection.getRequestSecurityTokens());
assertEquals("Unexpected number of requests", 1, parsedCollection.getRequestSecurityTokens().size());
-
- // repeat the tests, this time creating a source that contains the request message directly (no JAXBElement).
- source = new JAXBSource(this.context, request.getDelegate());
- baseRequest = factory.parseRequestSecurityToken(source);
- assertNotNull("Unexpected null request message", baseRequest);
- assertTrue("Unexpected request message type", baseRequest instanceof RequestSecurityToken);
-
- source = new JAXBSource(this.context, collection.getDelegate());
- baseRequest = factory.parseRequestSecurityToken(source);
- assertNotNull("Unexpected null request message", baseRequest);
- assertTrue("Unexpected request message type", baseRequest instanceof RequestSecurityTokenCollection);
}
/**
@@ -170,17 +159,6 @@
RequestSecurityTokenResponseCollection parsedCollection = (RequestSecurityTokenResponseCollection) baseResponse;
assertNotNull("Unexpected null response list", parsedCollection.getRequestSecurityTokenResponses());
assertEquals("Unexpected number of responses", 1, parsedCollection.getRequestSecurityTokenResponses().size());
-
- // repeat the tests, this time creating a source that contains the response message directly (no JAXBElement).
- source = new JAXBSource(this.context, response.getDelegate());
- baseResponse = factory.parseRequestSecurityTokenResponse(source);
- assertNotNull("Unexpected null response message", baseResponse);
- assertTrue("Unexpected response message type", baseResponse instanceof RequestSecurityTokenResponse);
-
- source = new JAXBSource(this.context, collection.getDelegate());
- baseResponse = factory.parseRequestSecurityTokenResponse(source);
- assertNotNull("Unexpected null response message", baseResponse);
- assertTrue("Unexpected response message type", baseResponse instanceof RequestSecurityTokenResponseCollection);
}
/**
Modified: identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenCollectionType.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenCollectionType.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenCollectionType.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -10,10 +10,10 @@
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@@ -45,7 +45,6 @@
@XmlType(name = "RequestSecurityTokenCollectionType", propOrder = {
"requestSecurityToken"
})
-@XmlRootElement
public class RequestSecurityTokenCollectionType {
@XmlElement(name = "RequestSecurityToken", required = true)
Modified: identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseCollectionType.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseCollectionType.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseCollectionType.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -12,11 +12,11 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -49,7 +49,6 @@
@XmlType(name = "RequestSecurityTokenResponseCollectionType", propOrder = {
"requestSecurityTokenResponse"
})
-@XmlRootElement
public class RequestSecurityTokenResponseCollectionType {
@XmlElement(name = "RequestSecurityTokenResponse", required = true)
Modified: identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseType.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseType.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenResponseType.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -12,15 +12,16 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
+
import org.w3c.dom.Element;
@@ -86,7 +87,6 @@
@XmlType(name = "RequestSecurityTokenResponseType", propOrder = {
"any"
})
-@XmlRootElement
public class RequestSecurityTokenResponseType {
@XmlAnyElement(lax = true)
Modified: identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenType.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenType.java 2009-05-25 08:21:26 UTC (rev 530)
+++ identity-federation/trunk/jboss-identity-fed-model/src/main/java/org/jboss/identity/federation/ws/trust/RequestSecurityTokenType.java 2009-05-25 13:25:00 UTC (rev 531)
@@ -18,7 +18,6 @@
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -83,7 +82,6 @@
@XmlType(name = "RequestSecurityTokenType", propOrder = {
"any"
})
-@XmlRootElement
public class RequestSecurityTokenType {
@XmlAnyElement(lax = true)
15 years, 7 months
JBoss Identity SVN: r530 - in idm/trunk: assembly and 16 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-25 04:21:26 -0400 (Mon, 25 May 2009)
New Revision: 530
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/integration/deployer/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
back to SNAPSHOT
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/assembly/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -3,14 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-assembly</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JBoss Identity IDM Assembly </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/distro/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -3,14 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-distro</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JBoss Identity IDM Distro </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/example/auth/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/example/simple/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-api/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-auth/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-cache/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-common/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-core/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-spi/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/integration/deployer/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/integration/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/parent/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-25 08:20:56 UTC (rev 529)
+++ idm/trunk/pom.xml 2009-05-25 08:21:26 UTC (rev 530)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha7</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 7 months
JBoss Identity SVN: r529 - idm/tags.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-25 04:20:56 -0400 (Mon, 25 May 2009)
New Revision: 529
Added:
idm/tags/1.0.0.Alpha7/
Log:
tag Alpha7
Copied: idm/tags/1.0.0.Alpha7 (from rev 528, idm/trunk)
15 years, 7 months
JBoss Identity SVN: r528 - in idm/trunk: assembly and 16 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-25 04:20:18 -0400 (Mon, 25 May 2009)
New Revision: 528
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/integration/deployer/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
Alpha7
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/assembly/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -3,14 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-assembly</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<packaging>jar</packaging>
<name>JBoss Identity IDM Assembly </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/distro/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -3,14 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-distro</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<packaging>jar</packaging>
<name>JBoss Identity IDM Distro </name>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/example/auth/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/example/simple/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-api/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-auth/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-cache/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-common/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-core/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-spi/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/integration/deployer/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
</parent>
<properties>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/integration/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/parent/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
+++ idm/trunk/pom.xml 2009-05-25 08:20:18 UTC (rev 528)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha7</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 7 months
JBoss Identity SVN: r527 - in idm/trunk: assembly and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-25 04:17:10 -0400 (Mon, 25 May 2009)
New Revision: 527
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/pom.xml
Log:
some fixes to the build
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-25 07:30:40 UTC (rev 526)
+++ idm/trunk/assembly/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
@@ -18,7 +18,7 @@
<hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
<hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
<hsqldb-version>1.8.0.7</hsqldb-version>
- <idm.version>1.0.0-SNAPSHOT</idm.version>
+ <idm.version>${project.version}</idm.version>
<apache.ant.version>1.7.0</apache.ant.version>
<mysql.connector.version>5.0.8</mysql.connector.version>
<postgresql.version>8.3-603.jdbc3</postgresql.version>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-25 07:30:40 UTC (rev 526)
+++ idm/trunk/distro/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>idm-distro</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JBoss Identity IDM Distro </name>
@@ -18,7 +18,7 @@
<hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
<hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
<hsqldb-version>1.8.0.7</hsqldb-version>
- <idm.version>1.0.0-SNAPSHOT</idm.version>
+ <idm.version>${project.version}</idm.version>
<apache.ant.version>1.7.0</apache.ant.version>
<izpack.version>4.2.1</izpack.version>
<mysql.connector.version>5.0.8</mysql.connector.version>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-25 07:30:40 UTC (rev 526)
+++ idm/trunk/pom.xml 2009-05-25 08:17:10 UTC (rev 527)
@@ -26,8 +26,8 @@
<module>idm-auth</module>
<module>idm-testsuite</module>
<module>integration</module>
- <!--<module>example/simple</module>-->
- <!--<module>example/auth</module>-->
+ <module>example/simple</module>
+ <module>example/auth</module>
</modules>
<profiles>
15 years, 7 months