[jboss-cvs] JBossAS SVN: r71643 - in projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml: types and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 2 18:10:34 EDT 2008


Author: anil.saldhana at jboss.com
Date: 2008-04-02 18:10:34 -0400 (Wed, 02 Apr 2008)
New Revision: 71643

Added:
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImpl.java
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImplBuilder.java
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeMarshaller.java
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeUnMarshaller.java
Modified:
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/types/XACMLAuthzDecisionStatementType.java
Log:
SECURITY-173: marshaller/unmarshaller for XACMLAuthzDecisionStatementType

Added: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImpl.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImpl.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImpl.java	2008-04-02 22:10:34 UTC (rev 71643)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.security.xacml.saml.integration.opensaml.impl;
+
+import java.util.List;
+
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.saml.integration.opensaml.types.XACMLAuthzDecisionStatementType;
+import org.opensaml.common.impl.AbstractSAMLObject;
+import org.opensaml.xml.XMLObject;
+
+
+/**
+ *  Implementation of the xacml authz decision statement
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Mar 27, 2008 
+ *  @version $Revision$
+ */
+public class XACMLAuthzDecisionStatementTypeImpl extends AbstractSAMLObject 
+implements XACMLAuthzDecisionStatementType
+{
+   private RequestContext requestContext;
+   private ResponseContext responseContext; 
+
+   /* 
+    * Constructor.
+    * @param nsURI the namespace the element is in
+    * @param localname the local name of the XML element 
+    * @param prefix the prefix for the given namespace
+    */
+   protected XACMLAuthzDecisionStatementTypeImpl(String nsURI, String localname, 
+         String prefix) 
+   {
+      super(nsURI, localname, prefix);
+      setElementNamespacePrefix(prefix);
+   }
+
+   public ResponseContext getResponse()
+   {   
+      return responseContext;
+   }
+
+   public void setResponse(ResponseContext response)
+   {
+      this.responseContext = response;
+   }  
+
+   public RequestContext getRequest()
+   {   
+      return requestContext;
+   }
+
+   public void setRequest(RequestContext request)
+   {
+      this.requestContext = request;
+   }  
+   
+   /** {@inheritDoc} */
+   public List<XMLObject> getOrderedChildren() 
+   {
+      throw new RuntimeException("Not implemented:getOrderedChildren()"); 
+   }
+}

Added: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImplBuilder.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImplBuilder.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeImplBuilder.java	2008-04-02 22:10:34 UTC (rev 71643)
@@ -0,0 +1,55 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.security.xacml.saml.integration.opensaml.impl;
+
+import org.jboss.security.xacml.saml.integration.opensaml.types.XACMLAuthzDecisionStatementType;
+import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+
+/**
+ *  Implementation Builder for the XACML Authorization Query Type
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Mar 28, 2008 
+ *  @version $Revision$
+ */
+public class XACMLAuthzDecisionStatementTypeImplBuilder 
+extends AbstractSAMLObjectBuilder<XACMLAuthzDecisionStatementType>
+{
+    /** Constructor. */
+    public XACMLAuthzDecisionStatementTypeImplBuilder() {
+
+    }
+
+    /** {@inheritDoc} */
+    public XACMLAuthzDecisionStatementType buildObject(String nsURI, 
+          String localName, String prefix) 
+    {
+        return new XACMLAuthzDecisionStatementTypeImpl(nsURI, localName, prefix);
+    }
+
+   @Override
+   public XACMLAuthzDecisionStatementType buildObject()
+   { 
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeMarshaller.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeMarshaller.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeMarshaller.java	2008-04-02 22:10:34 UTC (rev 71643)
@@ -0,0 +1,44 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.security.xacml.saml.integration.opensaml.impl;
+
+import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.io.MarshallingException;
+import org.w3c.dom.Element;
+
+/**
+ *  
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Apr 2, 2008 
+ *  @version $Revision$
+ */
+public class XACMLAuthzDecisionStatementTypeMarshaller extends AbstractSAMLObjectMarshaller
+{ 
+   @Override
+   public Element marshall(XMLObject xmlObject, Element parentElement) 
+   throws MarshallingException
+   {
+      return super.marshall(xmlObject, parentElement);
+   }
+
+}

Added: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeUnMarshaller.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeUnMarshaller.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/impl/XACMLAuthzDecisionStatementTypeUnMarshaller.java	2008-04-02 22:10:34 UTC (rev 71643)
@@ -0,0 +1,112 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.security.xacml.saml.integration.opensaml.impl;
+
+import java.io.IOException;
+
+import org.jboss.security.xacml.factories.RequestResponseContextFactory;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.saml.integration.opensaml.types.XACMLAuthzDecisionStatementType;
+import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.io.UnmarshallingException;
+import org.w3c.dom.Element;
+
+/**
+ *  
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Apr 2, 2008 
+ *  @version $Revision$
+ */
+public class XACMLAuthzDecisionStatementTypeUnMarshaller 
+extends AbstractSAMLObjectUnmarshaller
+{
+
+   @Override
+   protected void processChildElement(XMLObject parentObject, 
+         XMLObject childObject)
+         throws UnmarshallingException
+   {
+      XACMLAuthzDecisionStatementType xacmlAuthzDecisionStatementType = 
+         (XACMLAuthzDecisionStatementType) parentObject;
+
+      if (childObject instanceof ResponseContext) 
+      {
+         xacmlAuthzDecisionStatementType.setResponse((ResponseContext) childObject);
+      }
+      else
+      if (childObject instanceof RequestContext) 
+      {
+        xacmlAuthzDecisionStatementType.setRequest((RequestContext) childObject);
+      }
+      else 
+      {
+          super.processChildElement(parentObject, childObject);
+      }
+   } 
+
+   @Override
+   protected void unmarshallChildElement(XMLObject xmlObject, 
+         Element childElement) throws UnmarshallingException
+   {
+      XACMLAuthzDecisionStatementType xacmlAuthzDecisionStatementType = null;
+      if(xmlObject instanceof XACMLAuthzDecisionStatementType)
+      {
+         xacmlAuthzDecisionStatementType = (XACMLAuthzDecisionStatementType) xmlObject;
+      }
+      if(childElement.getLocalName().equals("Request") 
+            && childElement.getNamespaceURI().equals(XACMLConstants.CONTEXT_SCHEMA))
+      {
+         //process the xacml request
+         RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+         try
+         {
+            requestContext.readRequest(childElement);
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException(e);
+         } 
+         xacmlAuthzDecisionStatementType.setRequest(requestContext);
+      } 
+      else
+         if(childElement.getLocalName().equals("Response") 
+               && childElement.getNamespaceURI().equals(XACMLConstants.CONTEXT_SCHEMA))
+         {
+            //process the xacml response
+            ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+            try
+            {
+               responseContext.readResponse(childElement);
+            }
+            catch (IOException e)
+            {
+               throw new RuntimeException(e);
+            } 
+            xacmlAuthzDecisionStatementType.setResponse(responseContext);
+         }
+      else
+      super.unmarshallChildElement(xmlObject, childElement);
+   } 
+}
\ No newline at end of file

Modified: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/types/XACMLAuthzDecisionStatementType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/types/XACMLAuthzDecisionStatementType.java	2008-04-02 22:08:35 UTC (rev 71642)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/types/XACMLAuthzDecisionStatementType.java	2008-04-02 22:10:34 UTC (rev 71643)
@@ -23,12 +23,11 @@
 
 import javax.xml.namespace.QName;
 
-import org.jboss.security.xacml.core.model.context.RequestType;
-import org.jboss.security.xacml.core.model.context.ResponseType;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
 import org.jboss.security.xacml.saml.integration.opensaml.constants.SAMLXACMLConstants;
 import org.opensaml.saml2.core.Statement;
 
-//$Id$
 
 /**
  *  Represents a decision from XACML PDP
@@ -50,7 +49,7 @@
            DEFAULT_ELEMENT_LOCAL_NAME, SAMLXACMLConstants.SAML2_XACMLPROTOCOL_PREFIX);
 
    /** Default element name for XACML 2.0. */
-   QName DEFAULT_ELEMENT_NAME_XACML20 = new QName(SAMLXACMLConstants.SAML2_XACML20P_NS,
+   QName DEFAULT_ELEMENT_NAME_XACML20 = new QName(SAMLXACMLConstants.SAMLP,
            DEFAULT_ELEMENT_LOCAL_NAME, SAMLXACMLConstants.SAML2_XACMLPROTOCOL_PREFIX);
    
    /** Local name of the XSI type. */
@@ -67,16 +66,12 @@
    /** QName of the XSI type.XACML2.0. */
    QName TYPE_NAME_XACML20 = new QName(SAMLXACMLConstants.SAML2_XACML20P_NS, TYPE_LOCAL_NAME,
            SAMLXACMLConstants.SAML2_XACMLPROTOCOL_PREFIX);
-  
-   /** CombinePolicies attribute name. */
-   String COMBINEPOLICIES_ATTRIB_NAME = "CombinePolicies";
 
+   public RequestContext getRequest();
 
-   public RequestType getRequest();
+   public ResponseContext getResponse();
 
-   public ResponseType getResponse();
-
-   public void setRequest(RequestType request);
+   public void setRequest(RequestContext request);
  
-   public void setResponse(ResponseType response); 
+   public void setResponse(ResponseContext response); 
 }




More information about the jboss-cvs-commits mailing list