Author: anil.saldhana(a)jboss.com
Date: 2009-07-31 12:23:08 -0400 (Fri, 31 Jul 2009)
New Revision: 668
Added:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/util/SOAPSAMLXACMLUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/soap/
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/soap/SOAPSAMLXACML.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/SOAPFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/XACMLContextFactory.java
Removed:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/SOAPFactory.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java
Log:
JBID-150: api to make calls to xacml pdp
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-07-29
22:51:15 UTC (rev 667)
+++
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -40,9 +40,9 @@
import org.apache.log4j.Logger;
import org.jboss.identity.federation.api.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
+import org.jboss.identity.federation.core.factories.SOAPFactory;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
-import org.jboss.identity.federation.core.saml.v2.factories.SOAPFactory;
import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
import org.jboss.identity.federation.core.saml.v2.util.JAXBElementMappingUtil;
Modified:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2009-07-29
22:51:15 UTC (rev 667)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -51,11 +51,13 @@
* @since Mar 16, 2009
*/
public class InteropEndpointDebugTestCase extends TestCase
-{
- String endpoint = null;
- //String endpoint = "http://interop.demo.jboss.com/test/SOAPServlet";
- //String endpoint = "http://localhost:8080/test/SOAPServlet";
+{
+ String endpoint = null;
+
+ //String endpoint = "http://interop.demo.jboss.com/test/SOAPServlet";
+ //String endpoint = "http://localhost:8080/test/SOAPServlet";
+
public void testUseCase1() throws Exception
{
if(endpoint != null)
@@ -142,6 +144,7 @@
URL url = new URL(endpoint);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
+ m.marshal(soapRequest, System.out);
m.marshal(soapRequest, conn.getOutputStream());
return (JAXBElement<?>) um.unmarshal(conn.getInputStream());
Added:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/util/SOAPSAMLXACMLUnitTestCase.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/util/SOAPSAMLXACMLUnitTestCase.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/util/SOAPSAMLXACMLUnitTestCase.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.identity.federation.api.soap.SOAPSAMLXACML;
+import org.jboss.identity.federation.api.soap.SOAPSAMLXACML.Result;
+import org.jboss.security.xacml.core.model.context.ActionType;
+import org.jboss.security.xacml.core.model.context.AttributeType;
+import org.jboss.security.xacml.core.model.context.AttributeValueType;
+import org.jboss.security.xacml.core.model.context.EnvironmentType;
+import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.core.model.context.ResourceType;
+import org.jboss.security.xacml.core.model.context.SubjectType;
+import org.jboss.security.xacml.factories.RequestAttributeFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test the SOAP SAML XACML Unit Test
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 31, 2009
+ */
+public class SOAPSAMLXACMLUnitTestCase extends TestCase
+{
+ //Change it to true when you have an end point running locally
+ private boolean sendRequest = false;
+
+ private String endpoint = "http://localhost:8080/test/SOAPServlet";
+
+ private String issuer = "testIssuer";
+
+ public void testXACML() throws Exception
+ {
+ if(sendRequest)
+ {
+ //Create an XACML Request
+ RequestType xacmlRequest = getXACMLRequest();
+ SOAPSAMLXACML soapSAMLXACML = new SOAPSAMLXACML();
+
+ Result result = soapSAMLXACML.send(endpoint, issuer, xacmlRequest);
+ assertTrue("No fault", result.isFault() == false);
+ assertTrue("Decision available", result.isResponseAvailable());
+ assertTrue("Deny", result.isDeny());
+ }
+ }
+
+ private RequestType getXACMLRequest()
+ {
+ RequestType requestType = new RequestType();
+ requestType.getSubject().add(createSubject());
+ requestType.getResource().add(createResource());
+ requestType.setAction(createAction());
+ requestType.setEnvironment(createEnvironment());
+ return requestType;
+ }
+
+ private SubjectType createSubject()
+ {
+ //Create a subject type
+ SubjectType subject = new SubjectType();
+
subject.setSubjectCategory("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
+
+ subject.getAttribute().addAll(getSubjectAttributes());
+
+ return subject;
+ }
+
+ public ResourceType createResource()
+ {
+ ResourceType resourceType = new ResourceType();
+
+ AttributeType attResourceID = RequestAttributeFactory.createStringAttributeType(
+ "urn:va:xacml:2.0:interop:rsa8:resource:hl7:type", issuer,
+ "urn:va:xacml:2.0:interop:rsa8:resource:hl7:medical-record");
+
+ //Create a multi-valued attribute - hl7 permissions
+ AttributeType multi = new AttributeType();
+
multi.setAttributeId("urn:va:xacml:2.0:interop:rsa8:subject:hl7:permission");
+
multi.setDataType("http://www.w3.org/2001/XMLSchema#string");
+
+ if (issuer != null)
+ multi.setIssuer(issuer);
+
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-010"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-012"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-005"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-003"));
+
+
+ AttributeType attConfidentialityCode =
RequestAttributeFactory.createStringAttributeType(
+ "urn:va:xacml:2.0:interop:rsa8:resource:hl7:confidentiality-code",
issuer,
+ "MA");
+
+ AttributeType attDissentedSubjectId =
RequestAttributeFactory.createStringAttributeType(
+
"urn:va:xacml:2.0:interop:rsa8:resource:hl7:radiology:dissented-subject-id",
issuer,
+ "Doctor, Bob I");
+
+ //Add the attributes into the resource
+ resourceType.getAttribute().add(attResourceID);
+ resourceType.getAttribute().add(multi);
+ resourceType.getAttribute().add(attConfidentialityCode);
+ resourceType.getAttribute().add(attDissentedSubjectId);
+ return resourceType;
+ }
+
+ private ActionType createAction()
+ {
+ ActionType actionType = new ActionType();
+ AttributeType attActionID = RequestAttributeFactory.createStringAttributeType(
+ "urn:oasis:names:tc:xacml:1.0:action:action-id", issuer,
"read");
+ actionType.getAttribute().add(attActionID);
+ return actionType;
+ }
+
+ private List<AttributeType> getSubjectAttributes()
+ {
+ List<AttributeType> attrList = new ArrayList<AttributeType>();
+
+ //create the subject attributes
+
+ //SubjectID - Bob
+ AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
+ "urn:oasis:names:tc:xacml:1.0:subject:subject-id", issuer,
"Doctor, Bob I");
+
+ //Role - Physician
+ AttributeType attRole = RequestAttributeFactory.createStringAttributeType(
+ "urn:va:xacml:2.0:interop:rsa8:subject:role", issuer,
"Physician");
+
+
+ //Create a multi-valued attribute - hl7 permissions
+ AttributeType multi = new AttributeType();
+
multi.setAttributeId("urn:va:xacml:2.0:interop:rsa8:subject:hl7:permission");
+
multi.setDataType("http://www.w3.org/2001/XMLSchema#string");
+
+ if (issuer != null)
+ multi.setIssuer(issuer);
+
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-010"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-012"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-017"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-005"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-003"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-009"));
+
multi.getAttributeValue().add(createAttributeValueType("urn:va:xacml:2.0:interop:rsa8:hl7:prd-006"));
+
+ //Locality
+ AttributeType attLocality = RequestAttributeFactory.createStringAttributeType(
+ "urn:oasis:names:tc:xacml:1.0:subject:locality", issuer,
"Facility A");
+
+ attrList.add(attSubjectID);
+ attrList.add(attRole);
+ attrList.add(multi);
+ attrList.add(attLocality);
+
+ return attrList;
+ }
+
+ private EnvironmentType createEnvironment()
+ {
+ EnvironmentType env = new EnvironmentType();
+
+ AttributeType attFacility = RequestAttributeFactory.createStringAttributeType(
+ "urn:va:xacml:2.0:interop:rsa8:environment:locality", issuer,
"Facility A");
+
+ env.getAttribute().add(attFacility);
+ return env;
+ }
+
+ private AttributeValueType createAttributeValueType(String value)
+ {
+ AttributeValueType avt = new AttributeValueType();
+ avt.getContent().add(value);
+ return avt;
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/soap/SOAPSAMLXACML.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/soap/SOAPSAMLXACML.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/soap/SOAPSAMLXACML.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -0,0 +1,181 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.federation.api.soap;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.core.exceptions.ConfigurationException;
+import org.jboss.identity.federation.core.exceptions.ProcessingException;
+import org.jboss.identity.federation.core.factories.SOAPFactory;
+import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
+import org.jboss.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
+import org.jboss.identity.federation.core.saml.v2.util.XMLTimeUtil;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Body;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
+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.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
+import
org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
+import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
+import org.jboss.security.xacml.core.model.context.DecisionType;
+import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.core.model.context.ResultType;
+
+/**
+ * Class that deals with sending XACML
+ * Request Response bundled in SAML pay load
+ * as SOAP Requests
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 30, 2009
+ */
+public class SOAPSAMLXACML
+{
+ /**
+ * Given an xacml request
+ * @param endpoint
+ * @param issuer
+ * @param xacmlRequest
+ * @return
+ * @throws ProcessingException
+ */
+ public Result send(String endpoint, String issuer, RequestType xacmlRequest) throws
ProcessingException
+ {
+ try
+ {
+ XACMLAuthzDecisionQueryType queryType =
SOAPSAMLXACMLUtil.createXACMLAuthzDecisionQueryType();
+ queryType.setRequest(xacmlRequest);
+
+ //Create Issue Instant
+ queryType.setIssueInstant(XMLTimeUtil.getIssueInstant());
+
+ //Create Issuer
+ NameIDType nameIDType =
SAMLAssertionFactory.getObjectFactory().createNameIDType();
+ nameIDType.setValue(issuer);
+ queryType.setIssuer(nameIDType);
+
+ JAXBElement<?> jaxbQueryType = SOAPSAMLXACMLUtil.getJAXB(queryType);
+
+ Envelope envelope = createEnvelope(jaxbQueryType);
+
+ JAXBElement<?> soapRequest =
SOAPFactory.getObjectFactory().createEnvelope(envelope);
+
+ Marshaller marshaller = SOAPSAMLXACMLUtil.getMarshaller();
+ Unmarshaller unmarshaller = SOAPSAMLXACMLUtil.getUnmarshaller();
+
+ //Send it across the wire
+ URL url = new URL(endpoint);
+ URLConnection conn = url.openConnection();
+ conn.setDoOutput(true);
+ marshaller.marshal(soapRequest, conn.getOutputStream());
+
+ JAXBElement<?> result = (JAXBElement<?>)
unmarshaller.unmarshal(conn.getInputStream());
+ Envelope resultEnvelope = (Envelope) result.getValue();
+
+ JAXBElement<?> samlResponse = (JAXBElement<?>)
resultEnvelope.getBody().getAny().get(0);
+ Object response = samlResponse.getValue();
+ if(response instanceof Fault)
+ {
+ Fault fault = (Fault) response;
+ return new Result(null,fault);
+ }
+
+ ResponseType responseType = (ResponseType) response;
+ AssertionType at = (AssertionType)
responseType.getAssertionOrEncryptedAssertion().get(0);
+ XACMLAuthzDecisionStatementType xst = (XACMLAuthzDecisionStatementType)
at.getStatementOrAuthnStatementOrAuthzDecisionStatement().get(0);
+ ResultType rt = xst.getResponse().getResult().get(0);
+ DecisionType dt = rt.getDecision();
+
+ return new Result(dt,null);
+ }
+ catch (JAXBException e)
+ {
+ throw new ProcessingException(e);
+ }
+ catch (IOException e)
+ {
+ throw new ProcessingException(e);
+ }
+ catch (ConfigurationException e)
+ {
+ throw new ProcessingException(e);
+ }
+ }
+
+ private Envelope createEnvelope(JAXBElement<?> jaxbElement)
+ {
+ Envelope envelope = SOAPFactory.getObjectFactory().createEnvelope();
+ Body body = SOAPFactory.getObjectFactory().createBody();
+ body.getAny().add(jaxbElement);
+ envelope.setBody(body);
+ return envelope;
+ }
+
+ public class Result
+ {
+ private Fault fault = null;
+ private DecisionType decisionType;
+
+ Result(DecisionType decision, Fault fault)
+ {
+ this.decisionType = decision;
+ this.fault = fault;
+ }
+
+ public boolean isResponseAvailable()
+ {
+ return decisionType != null;
+ }
+
+ public boolean isFault()
+ {
+ return fault != null;
+ }
+
+ public DecisionType getDecision()
+ {
+ return decisionType;
+ }
+
+ public Fault getFault()
+ {
+ return fault;
+ }
+
+ public boolean isPermit()
+ {
+ return decisionType == DecisionType.PERMIT;
+ }
+
+ public boolean isDeny()
+ {
+ return decisionType == DecisionType.DENY;
+ }
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/SOAPFactory.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/SOAPFactory.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/SOAPFactory.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.federation.core.factories;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.core.util.JAXBUtil;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.ObjectFactory;
+
+/**
+ * Provides an handle to the ObjectFactory that is capable
+ * of creating SOAP objects
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+public class SOAPFactory
+{
+ private static ObjectFactory factory = new ObjectFactory();
+
+ public static ObjectFactory getObjectFactory()
+ {
+ return factory;
+ }
+
+ public static Marshaller getMarshaller() throws JAXBException
+ {
+ return
JAXBUtil.getMarshaller("org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope");
+ }
+
+ public static Unmarshaller getUnmarshaller() throws JAXBException
+ {
+ return
JAXBUtil.getUnmarshaller("org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope");
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/XACMLContextFactory.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/XACMLContextFactory.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/factories/XACMLContextFactory.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -0,0 +1,40 @@
+/*
+ * 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.factories;
+
+import org.jboss.security.xacml.core.model.context.ObjectFactory;
+
+
+/**
+ * Provides handle to XACML Object Factory
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 30, 2009
+ */
+public class XACMLContextFactory
+{
+ private static ObjectFactory _objectFactory = new ObjectFactory();
+
+ public static ObjectFactory getObjectFactory()
+ {
+ return _objectFactory;
+ }
+}
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/SOAPFactory.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/SOAPFactory.java 2009-07-29
22:51:15 UTC (rev 667)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/factories/SOAPFactory.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.identity.federation.core.saml.v2.factories;
-
-import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.ObjectFactory;
-
-/**
- * Provides an handle to the ObjectFactory that is capable
- * of creating SOAP objects
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 28, 2009
- */
-public class SOAPFactory
-{
- private static ObjectFactory factory = new ObjectFactory();
-
- public static ObjectFactory getObjectFactory()
- {
- return factory;
- }
-}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java 2009-07-29
22:51:15 UTC (rev 667)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -23,9 +23,9 @@
import javax.xml.bind.JAXBElement;
+import org.jboss.identity.federation.core.factories.SOAPFactory;
import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
import org.jboss.identity.federation.core.saml.v2.factories.SAMLProtocolFactory;
-import org.jboss.identity.federation.core.saml.v2.factories.SOAPFactory;
import org.jboss.identity.federation.core.saml.v2.factories.XACMLStatementFactory;
import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
import org.jboss.identity.federation.saml.v2.assertion.EncryptedElementType;
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java 2009-07-29
22:51:15 UTC (rev 667)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/SOAPSAMLXACMLUtil.java 2009-07-31
16:23:08 UTC (rev 668)
@@ -25,6 +25,7 @@
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
@@ -53,6 +54,11 @@
private static String collectivePackage = getPackage();
+ private static
org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.ObjectFactory
+ queryTypeObjectFactory = new
org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.ObjectFactory();
+
+ private static ObjectFactory statementObjectFactory = new ObjectFactory();
+
/**
* Parse the XACML Authorization Decision Query from the Dom Element
* @param samlRequest
@@ -76,12 +82,36 @@
return (XACMLAuthzDecisionQueryType)xacmlObject;
}
+ public static XACMLAuthzDecisionQueryType createXACMLAuthzDecisionQueryType()
+ {
+ return queryTypeObjectFactory.createXACMLAuthzDecisionQueryType();
+ }
+
public static XACMLAuthzDecisionStatementType createXACMLAuthzDecisionStatementType()
{
- ObjectFactory of = new ObjectFactory();
- return of.createXACMLAuthzDecisionStatementType();
+ return statementObjectFactory.createXACMLAuthzDecisionStatementType();
}
+ public static JAXBElement<XACMLAuthzDecisionQueryType>
getJAXB(XACMLAuthzDecisionQueryType queryType)
+ {
+ return queryTypeObjectFactory.createXACMLAuthzDecisionQuery(queryType);
+ }
+
+ public static JAXBElement<XACMLAuthzDecisionStatementType>
getJAXB(XACMLAuthzDecisionStatementType stmtType)
+ {
+ return statementObjectFactory.createXACMLAuthzDecisionStatement(stmtType);
+ }
+
+ public static Marshaller getMarshaller() throws JAXBException
+ {
+ return JAXBUtil.getMarshaller(getPackage());
+ }
+
+ public static Unmarshaller getUnmarshaller() throws JAXBException
+ {
+ return JAXBUtil.getUnmarshaller(getPackage());
+ }
+
public static String getPackage()
{
StringBuffer buf = new StringBuffer();