Author: anil.saldhana(a)jboss.com
Date: 2010-12-20 17:35:31 -0500 (Mon, 20 Dec 2010)
New Revision: 614
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/filters/SPFilter.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
Log:
changes
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
===================================================================
---
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -22,27 +22,17 @@
package org.picketlink.test.identity.federation.bindings.servlets;
import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
import junit.framework.TestCase;
+import org.jboss.security.xacml.core.model.context.RequestType;
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
-import org.picketlink.identity.federation.core.util.JAXBUtil;
import
org.picketlink.identity.federation.newmodel.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
-import org.picketlink.identity.federation.newmodel.saml.v2.protocol.ResponseType;
import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
-import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
-//import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
import org.w3c.dom.Document;
-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;
/**
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
===================================================================
---
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -3,14 +3,13 @@
import java.security.Principal;
import java.security.acl.Group;
import java.util.Enumeration;
-import java.util.List;
import java.util.Map;
import javax.security.auth.Subject;
import org.apache.log4j.Logger;
import org.jboss.security.SecurityContextAssociation;
-import
org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenAttributeProvider;
+import
org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenAttributeProvider;
import
org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType;
import
org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType.ASTChoiceType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
@@ -107,5 +106,4 @@
return attributeStatement;
}
}
-
-}
+}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
===================================================================
---
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -23,14 +23,15 @@
import java.util.List;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
import
org.picketlink.identity.federation.core.saml.md.providers.MetaDataBuilderDelegate;
-import org.picketlink.identity.federation.newmodel.saml.v2.metadata.*;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EndpointType;
+import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.OrganizationType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SSODescriptorType;
/**
Modified:
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java
===================================================================
---
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -21,13 +21,18 @@
*/
package org.picketlink.identity.federation.api.saml.v2.metadata;
+import java.io.StringWriter;
import java.util.List;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
+import org.picketlink.identity.federation.core.saml.v2.writers.SAMLMetadataWriter;
+import org.picketlink.identity.federation.core.util.StaxUtil;
import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EndpointType;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.IDPSSODescriptorType;
import org.picketlink.identity.federation.newmodel.saml.v2.metadata.IndexedEndpointType;
-import org.picketlink.identity.federation.newmodel.saml.v2.metadata.RoleDescriptorType;
import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SPSSODescriptorType;
import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SSODescriptorType;
@@ -49,10 +54,24 @@
*/
public static String toString(EntityDescriptorType edt)
{
- StringBuilder builder = new StringBuilder();
- throw new RuntimeException();
- /* List<RoleDescriptorType> rolesD =
edt.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+ StringWriter sw = new StringWriter();
+ try
+ {
+ XMLStreamWriter writer = StaxUtil.getXMLStreamWriter(sw );
+
+ SAMLMetadataWriter metaWriter = new SAMLMetadataWriter(writer);
+ metaWriter.writeEntityDescriptor(edt);
+ }
+ catch (ProcessingException e)
+ {
+ throw new RuntimeException( e );
+ }
+ return sw.toString();
+
+ /*StringBuilder builder = new StringBuilder();
+ List<RoleDescriptorType> rolesD =
edt.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+
for(RoleDescriptorType rdt: rolesD)
{
builder.append("ID=").append(rdt.getID());
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -25,9 +25,9 @@
import java.security.PublicKey;
import java.util.Map;
-import javax.xml.bind.JAXBElement;
-
-import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
+import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
+import
org.picketlink.identity.federation.core.parsers.saml.metadata.SAMLEntityDescriptorParser;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
/**
@@ -59,18 +59,17 @@
/**
* @see IMetadataProvider#getMetaData()
- */
- @SuppressWarnings("unchecked")
+ */
public EntityDescriptorType getMetaData()
- {
- EntityDescriptorType edt = null;
-
+ {
if(this.metadataFileStream == null)
throw new RuntimeException("Metadata file is not injected");
try
{
- new RuntimeException();/*
+ SAMLEntityDescriptorParser parser = new SAMLEntityDescriptorParser();
+ return (EntityDescriptorType) parser.parse(
StaxParserUtil.getXMLEventReader(metadataFileStream));
+ /*
JAXBElement<EntityDescriptorType> j =
(JAXBElement<EntityDescriptorType>)
MetaDataBuilderDelegate.getUnmarshaller().unmarshal(metadataFileStream);
edt = j.getValue();
@@ -79,8 +78,7 @@
catch(Exception e)
{
throw new RuntimeException(e);
- }
- return edt;
+ }
}
/**
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -91,9 +91,8 @@
private static ObjectFactory objectFactory = new ObjectFactory();
private static XMLSignatureFactory fac = getXMLSignatureFactory();
-
- @SuppressWarnings("restriction")
-private static XMLSignatureFactory getXMLSignatureFactory()
+
+ private static XMLSignatureFactory getXMLSignatureFactory()
{
XMLSignatureFactory xsf = null;
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -25,7 +25,6 @@
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.JAXBElement;
import javax.xml.crypto.dsig.DigestMethod;
import javax.xml.crypto.dsig.SignatureMethod;
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -32,7 +32,6 @@
import java.util.List;
import java.util.Map;
-import javax.xml.bind.JAXBElement;
import javax.xml.datatype.DatatypeConstants;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
@@ -96,7 +95,6 @@
import org.picketlink.identity.xmlsec.w3.xmldsig.RSAKeyValueType;
import org.picketlink.identity.xmlsec.w3.xmldsig.X509CertificateType;
import org.picketlink.identity.xmlsec.w3.xmldsig.X509DataType;
-import org.picketlink.identity.xmlsec.w3.xmlenc.EncryptedKeyType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/filters/SPFilter.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/filters/SPFilter.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/filters/SPFilter.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -50,7 +50,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.crypto.MarshalException;
import javax.xml.crypto.dsig.CanonicalizationMethod;
@@ -83,12 +82,12 @@
import org.picketlink.identity.federation.core.saml.v2.impl.DefaultSAML2HandlerRequest;
import org.picketlink.identity.federation.core.saml.v2.impl.DefaultSAML2HandlerResponse;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2Handler;
+import
org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2Handler.HANDLER_TYPE;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChain;
import
org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
-import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
-import
org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2Handler.HANDLER_TYPE;
import
org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest.GENERATE_REQUEST_TYPE;
+import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
import org.picketlink.identity.federation.core.saml.v2.util.AssertionUtil;
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.HandlerUtil;
@@ -106,7 +105,7 @@
import org.picketlink.identity.federation.newmodel.saml.v2.protocol.ResponseType;
import org.picketlink.identity.federation.newmodel.saml.v2.protocol.StatusResponseType;
import org.picketlink.identity.federation.newmodel.saml.v2.protocol.StatusType;
-import org.picketlink.identity.federation.saml.v2.SAML2Object;
+import org.picketlink.identity.federation.saml.v2.SAML2Object;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
import org.picketlink.identity.federation.web.interfaces.IRoleValidator;
@@ -714,8 +713,7 @@
* @param serverEnvironment tomcat,jboss etc
* @return
* @throws AssertionExpiredException
- */
- @SuppressWarnings("unchecked")
+ */
public Principal handleSAMLResponse(HttpServletRequest request, ResponseType
responseType)
throws ConfigurationException, AssertionExpiredException
{
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -21,10 +21,9 @@
*/
package org.picketlink.identity.federation.web.servlets.saml;
+import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
+
import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -34,18 +33,12 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import org.picketlink.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
import
org.picketlink.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
-import
org.picketlink.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
+import
org.picketlink.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
-
-import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
-
/**
* Circle of trust establishing servlet that accesses
* the metadata urls of the various sites and updates
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -37,6 +37,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.stream.XMLStreamWriter;
import org.apache.log4j.Logger;
import
org.picketlink.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder;
@@ -46,10 +47,13 @@
import org.picketlink.identity.federation.core.config.KeyValueType;
import org.picketlink.identity.federation.core.config.MetadataProviderType;
import org.picketlink.identity.federation.core.config.ProviderType;
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
import org.picketlink.identity.federation.core.interfaces.TrustKeyManager;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.picketlink.identity.federation.core.saml.v2.writers.SAMLMetadataWriter;
import org.picketlink.identity.federation.core.util.CoreConfigUtil;
+import org.picketlink.identity.federation.core.util.StaxUtil;
import org.picketlink.identity.federation.core.util.XMLEncryptionUtil;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
import
org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType.EDTDescriptorChoiceType;
@@ -179,7 +183,18 @@
{
resp.setContentType(JBossSAMLConstants.METADATA_MIME.get());
OutputStream os = resp.getOutputStream();
- throw new RuntimeException();/*
+
+ try
+ {
+ XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter( os );
+ SAMLMetadataWriter writer = new SAMLMetadataWriter( streamWriter );
+ writer.writeEntityDescriptor(metadata);
+ }
+ catch (ProcessingException e)
+ {
+ throw new ServletException( e );
+ }
+ /*
JAXBElement<?> jaxbEl =
MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata);
try
{
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java 2010-12-20
22:22:49 UTC (rev 613)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java 2010-12-20
22:35:31 UTC (rev 614)
@@ -70,7 +70,6 @@
import
org.picketlink.identity.federation.newmodel.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
import
org.picketlink.identity.federation.newmodel.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;