[jboss-identity-commits] JBoss Identity SVN: r258 - identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util.

jboss-identity-commits at lists.jboss.org jboss-identity-commits at lists.jboss.org
Wed Jan 28 17:30:38 EST 2009


Author: anil.saldhana at jboss.com
Date: 2009-01-28 17:30:38 -0500 (Wed, 28 Jan 2009)
New Revision: 258

Added:
   identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java
Log:
add util

Added: identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java
===================================================================
--- identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java	                        (rev 0)
+++ identity-federation/trunk/identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java	2009-01-28 22:30:38 UTC (rev 258)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.identity.federation.core.saml.v2.util;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.saml.v2.profiles.xacml.assertion.ObjectFactory;
+import org.jboss.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
+
+/**
+ * Utility associated with SOAP 1.1 Envelope,
+ * SAML2 and XACML2
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 28, 2009
+ */
+public class SOAPSAMLXACMLUtil
+{
+   private static String SOAP_PKG = "org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope";
+   private static String SAML_PROTO_PKG = "org.jboss.identity.federation.saml.v2.protocol";
+   private static String XACML_CTX_PKG = "org.jboss.security.xacml.core.model.context";
+   private static String XACML_SAMLPROTO_PKG = "org.jboss.identity.federation.saml.v2.profiles.xacml.protocol";
+   private static String XACML_SAMLASSERT_PKG = "org.jboss.identity.federation.saml.v2.profiles.xacml.assertion";
+   
+   private static String COLON = ":";
+   
+   private static String collectivePackage = getPackage();
+   
+   public static Marshaller getMarshaller() throws JAXBException
+   { 
+      JAXBContext jaxb = JAXBContext.newInstance(collectivePackage);
+      return jaxb.createMarshaller();
+   }
+   public static Unmarshaller getUnmarshaller() throws JAXBException
+   {
+      JAXBContext jaxb = JAXBContext.newInstance(collectivePackage);
+      Unmarshaller un = jaxb.createUnmarshaller();
+      return un;
+   }
+   
+   public static XACMLAuthzDecisionStatementType createXACMLAuthzDecisionStatementType()
+   {
+      ObjectFactory of = new ObjectFactory();
+      return of.createXACMLAuthzDecisionStatementType();
+   }
+   
+   private static String getPackage()
+   {
+      StringBuffer buf = new StringBuffer();
+      buf.append(SOAP_PKG).append(COLON).append(SAML_PROTO_PKG).append(COLON);
+      buf.append(XACML_CTX_PKG).append(COLON).append(XACML_SAMLPROTO_PKG).append(COLON).append(XACML_SAMLASSERT_PKG); 
+      return buf.toString();
+   }
+}
\ No newline at end of file




More information about the jboss-identity-commits mailing list