[jboss-svn-commits] JBL Code SVN: r29587 - in labs/jbossesb/trunk/product/rosetta: src/org/jboss/soa/esb/services/security/auth/login and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 13 05:22:03 EDT 2009
Author: beve
Date: 2009-10-13 05:22:03 -0400 (Tue, 13 Oct 2009)
New Revision: 29587
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPExtractorUtil.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractor.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractorUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-expected-example.xml
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/WSSecuritySoapExtractor.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSTestUtil.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2880 "BaseWebService: Add support for SAML token extraction"
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java 2009-10-13 04:43:49 UTC (rev 29586)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -61,6 +61,7 @@
import org.jboss.soa.esb.services.security.SecurityServiceException;
import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
import org.jboss.soa.esb.services.security.auth.ExtractorUtil;
+import org.jboss.soa.esb.services.security.auth.ws.SamlSoapAssertionExtractor;
import org.jboss.soa.esb.services.security.auth.ws.WSSecuritySoapExtractor;
import org.w3c.dom.Document;
@@ -83,7 +84,8 @@
private static final String ADDRESSING_NAMESPACE = ADDRESSING_BUILDER.getNamespaceURI() ;
private static final QName ADDRESSING_REPLY = new QName(ADDRESSING_NAMESPACE, "Reply") ;
- private final WSSecuritySoapExtractor securityExtractor = new WSSecuritySoapExtractor();
+ private final WSSecuritySoapExtractor wsseExtractor = new WSSecuritySoapExtractor();
+ private final SamlSoapAssertionExtractor samlExtractor = new SamlSoapAssertionExtractor();
protected final ServiceInvoker serviceInvoker ;
protected final MessagePayloadProxy requestProxy ;
@@ -249,7 +251,15 @@
protected AuthenticationRequest extractSecurityDetails(SOAPMessage request, Message esbReq) throws SecurityServiceException
{
- return securityExtractor.extractSecurityInfo(request);
+ AuthenticationRequest authRequest = wsseExtractor.extractSecurityInfo(request);
+ if (authRequest == null)
+ {
+ return samlExtractor.extractSecurityInfo(request);
+ }
+ else
+ {
+ return authRequest;
+ }
}
private SOAPMessage generateFault(final Throwable th)
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java 2009-10-13 04:43:49 UTC (rev 29586)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/login/JBossSTSLoginModule.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -233,6 +233,7 @@
}
Set<?> credentials = authRequest.getCredentials();
+
for (Object object : credentials)
{
if (object instanceof SamlCredential)
@@ -242,7 +243,7 @@
}
}
- throw new LoginException("Could not locate a SamplPrincipal in the AuthenticationRequest.");
+ throw new LoginException("Could not locate a SamlCredential in the AuthenticationRequest.");
}
public boolean commit() throws LoginException
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPExtractorUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPExtractorUtil.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SOAPExtractorUtil.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.auth.ws;
+
+import java.util.Iterator;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+
+/**
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class SOAPExtractorUtil
+{
+ /**
+ * Security element localname
+ */
+ public static final String WSSE_LN = "Security";
+
+ /**
+ * SOAP Message Security 1.0 NameSpace URL
+ */
+ public static final String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ public static final String WSSE_NS2 = "http://schemas.xmlsoap.org/ws/2002/04/secext";
+
+ /**
+ * SOAP Message Security 1.1 NameSpace URL
+ */
+ public static final String WSSE11_NS = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd";
+
+ private SOAPExtractorUtil()
+ {
+ }
+
+ public static SOAPHeaderElement getSecurityHeader( final SOAPEnvelope env ) throws SOAPException
+ {
+ final SOAPHeader soapHeader = env.getHeader();
+ if ( soapHeader == null)
+ return null;
+
+ Iterator<?> headerElements = soapHeader.examineAllHeaderElements();
+ while ( headerElements.hasNext() )
+ {
+ final SOAPHeaderElement header = (SOAPHeaderElement) headerElements.next();
+ final Name name = header.getElementName();
+
+ if (name.getLocalName().equalsIgnoreCase(WSSE_LN))
+ {
+ String nsURI = name.getURI();
+ if (nsURI.equalsIgnoreCase(WSSE_NS) || nsURI.equalsIgnoreCase(WSSE_NS2) || nsURI.equalsIgnoreCase(WSSE11_NS))
+ {
+ return header;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractor.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractor.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractor.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.auth.ws;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+import org.jboss.soa.esb.services.security.auth.SecurityInfoExtractor;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.jboss.soa.esb.services.security.principals.User;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Extracts SAML Assertions from a SOAPMessage. </p>
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlSoapAssertionExtractor implements SecurityInfoExtractor<SOAPMessage>
+{
+ private Logger log = Logger.getLogger(SamlSoapAssertionExtractor.class);
+
+ public AuthenticationRequest extractSecurityInfo(final SOAPMessage soap)
+ {
+ if ( soap == null )
+ {
+ return null;
+ }
+
+ User user = null;
+ Set<Object> credentials = new HashSet<Object>();
+
+ try
+ {
+ final SOAPHeaderElement securityHeader = SOAPExtractorUtil.getSecurityHeader( soap.getSOAPPart().getEnvelope() );
+ if ( securityHeader == null )
+ {
+ return null;
+ }
+ Iterator childElements = securityHeader.getChildElements();
+ while (childElements.hasNext())
+ {
+ final Node securityNode = (Node) childElements.next();
+ if ( securityNode.getNodeType() == Node.ELEMENT_NODE )
+ {
+ final String localName = securityNode.getLocalName();
+ if ("Assertion".equalsIgnoreCase(localName))
+ {
+ credentials.add(new SamlCredential((Element)securityNode));
+ }
+ }
+ }
+
+ // build the AuthenticationRequest.
+ return new AuthenticationRequestImpl.Builder(user, credentials ).build();
+ }
+ catch (final SOAPException e)
+ {
+ log.error("Caught a SOAPException while trying to extract security information: ", e);
+ throw new SecurityException("Could not extract security info from SOAPMessage");
+ }
+ }
+
+}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/WSSecuritySoapExtractor.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/WSSecuritySoapExtractor.java 2009-10-13 04:43:49 UTC (rev 29586)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/services/security/auth/ws/WSSecuritySoapExtractor.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -24,10 +24,7 @@
import java.util.Iterator;
import java.util.Set;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
import javax.xml.soap.SOAPMessage;
@@ -58,22 +55,6 @@
*/
public class WSSecuritySoapExtractor implements SecurityInfoExtractor<SOAPMessage>
{
- /**
- * Security element localname
- */
- public static final String WSSE_LN = "Security";
-
- /**
- * SOAP Message Security 1.0 NameSpace URL
- */
- public static final String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
- public static final String WSSE_NS2 = "http://schemas.xmlsoap.org/ws/2002/04/secext";
-
- /**
- * SOAP Message Security 1.1 NameSpace URL
- */
- public static final String WSSE11_NS = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd";
-
private Logger log = Logger.getLogger(WSSecuritySoapExtractor.class);
/**
@@ -105,7 +86,7 @@
try
{
- final SOAPHeaderElement securityHeader = getSecurityHeader( soap.getSOAPPart().getEnvelope() );
+ final SOAPHeaderElement securityHeader = SOAPExtractorUtil.getSecurityHeader( soap.getSOAPPart().getEnvelope() );
if ( securityHeader == null )
{
return null;
@@ -141,7 +122,10 @@
}
}
// build the AuthenticationRequest.
- return new AuthenticationRequestImpl.Builder(user, credentials ).build();
+ if (user != null || !credentials.isEmpty())
+ return new AuthenticationRequestImpl.Builder(user, credentials ).build();
+ else
+ return null;
}
catch (final SOAPException e)
{
@@ -150,30 +134,6 @@
}
}
- private SOAPHeaderElement getSecurityHeader( final SOAPEnvelope env ) throws SOAPException
- {
- final SOAPHeader soapHeader = env.getHeader();
- if ( soapHeader == null)
- return null;
-
- Iterator<?> headerElements = soapHeader.examineAllHeaderElements();
- while ( headerElements.hasNext() )
- {
- final SOAPHeaderElement header = (SOAPHeaderElement) headerElements.next();
- final Name name = header.getElementName();
-
- if (name.getLocalName().equalsIgnoreCase(WSSE_LN))
- {
- String nsURI = name.getURI();
- if (nsURI.equalsIgnoreCase(WSSE_NS) || nsURI.equalsIgnoreCase(WSSE_NS2) || nsURI.equalsIgnoreCase(WSSE11_NS))
- {
- return header;
- }
- }
- }
- return null;
- }
-
private BinarySecurityToken createBinarySecurityToken( final Node node )
{
final NamedNodeMap attributes = node.getAttributes();;
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java 2009-10-13 04:43:49 UTC (rev 29586)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlAssertionExtractorUnitTest.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -20,7 +20,7 @@
*/
package org.jboss.soa.esb.services.security.auth.ws;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
@@ -29,7 +29,6 @@
import junit.framework.JUnit4TestAdapter;
-import org.jboss.identity.federation.core.wstrust.WSTrustException;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.util.ClassUtil;
@@ -46,14 +45,14 @@
public class SamlAssertionExtractorUnitTest
{
@Test
- public void test() throws ConfigurationException, SAXException, IOException, ParserConfigurationException, WSTrustException
+ public void extractAssertionFromSOAPString() throws Exception
{
final SamlAssertionExtractor extractor = new SamlAssertionExtractor();
final Node samlAssertion = extractor.extractSamlAssertion(readFile("soap-saml-example.xml"));
assertEquals("saml:Assertion", samlAssertion.getNodeName());
}
-
+
private String readFile(final String fileName) throws SAXException, IOException, ParserConfigurationException, ConfigurationException
{
InputStream inputStream = ClassUtil.getResourceAsStream(fileName, getClass());
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractorUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/SamlSoapAssertionExtractorUnitTest.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.soa.esb.services.security.auth.ws;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequest;
+import org.jboss.soa.esb.services.security.auth.login.SamlCredential;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import junit.framework.JUnit4TestAdapter;
+
+/**
+ * Unit test for {@link SamlSoapAssertionExtractor}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SamlSoapAssertionExtractorUnitTest
+{
+ @Test
+ public void extractAssertionFromSOAPMessage() throws Exception
+ {
+ final SamlSoapAssertionExtractor extractor = new SamlSoapAssertionExtractor();
+ final SOAPMessage soap = WSTestUtil.createMessage("soap-saml-example.xml", getClass());
+
+ final AuthenticationRequest authRequest = extractor.extractSecurityInfo(soap);
+
+ assertNotNull(authRequest);
+ final Set<?> credentials = authRequest.getCredentials();
+ assertFalse(credentials.isEmpty());
+ assertEquals(1, credentials.size());
+ final Object credential = credentials.iterator().next();
+ assertTrue(credential instanceof SamlCredential);
+
+ final String expectedAssertion = readFile("saml-expected-example.xml");
+ final String actualAssertion = ((SamlCredential) credential).getAssertion();
+ assertTrue(XMLHelper.compareXMLContent(expectedAssertion, actualAssertion));
+ }
+
+ private String readFile(final String fileName) throws SAXException, IOException, ParserConfigurationException, ConfigurationException
+ {
+ InputStream inputStream = ClassUtil.getResourceAsStream(fileName, getClass());
+ return new String(StreamUtils.readStream(inputStream));
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SamlSoapAssertionExtractorUnitTest.class);
+ }
+
+}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSTestUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSTestUtil.java 2009-10-13 04:43:49 UTC (rev 29586)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/WSTestUtil.java 2009-10-13 09:22:03 UTC (rev 29587)
@@ -82,7 +82,7 @@
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
- Name security = soapEnvelope.createName(WSSecuritySoapExtractor.WSSE_LN, "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name security = soapEnvelope.createName(SOAPExtractorUtil.WSSE_LN, "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPHeaderElement headerElement = soapHeader.addHeaderElement( security );
createBinaryHeaderElement(soapEnvelope, headerElement, encodingType, valueType, cert );
@@ -123,7 +123,7 @@
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
- Name security = soapEnvelope.createName(WSSecuritySoapExtractor.WSSE_LN, "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name security = soapEnvelope.createName(SOAPExtractorUtil.WSSE_LN, "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPHeaderElement headerElement = soapHeader.addHeaderElement( security );
createUsernameTokenHeaderElement(soapEnvelope, headerElement, username, password );
@@ -200,7 +200,7 @@
final String cert) throws SOAPException
{
// create the BinarySecurityToken element
- Name binarySecurityTokenName = soapEnvelope.createName("BinarySecurityToken", "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name binarySecurityTokenName = soapEnvelope.createName("BinarySecurityToken", "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPElement binarySecurityTokenElement = headerElement.addChildElement(binarySecurityTokenName);
// add the EncodingType attribute
@@ -219,13 +219,13 @@
final String password) throws SOAPException
{
// create the UsernameToken element
- Name usernameTokenName = soapEnvelope.createName("UsernameToken", "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name usernameTokenName = soapEnvelope.createName("UsernameToken", "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPElement usernameTokenElement = headerElement.addChildElement(usernameTokenName);
// create and add the Username sub element
if ( username != null )
{
- Name usernameName = soapEnvelope.createName("Username", "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name usernameName = soapEnvelope.createName("Username", "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPElement usernameNode = usernameTokenElement.addChildElement(usernameName);
usernameNode.addTextNode(username);
}
@@ -233,7 +233,7 @@
// create and add the password sub element
if ( password != null )
{
- Name passwordName = soapEnvelope.createName("password", "wsse", WSSecuritySoapExtractor.WSSE_NS);
+ Name passwordName = soapEnvelope.createName("password", "wsse", SOAPExtractorUtil.WSSE_NS);
SOAPElement passwordNode = usernameTokenElement.addChildElement(passwordName);
passwordNode.addTextNode(password);
}
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-expected-example.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-expected-example.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/services/security/auth/ws/saml-expected-example.xml 2009-10-13 09:22:03 UTC (rev 29587)
@@ -0,0 +1,17 @@
+<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" IssueInstant="2005-04-01T16:58:33.173Z" Version="2.0">
+ <saml:Issuer>http://authority.example.com/</saml:Issuer>
+ <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signature>
+ <saml:Subject>
+ <saml:NameID format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">
+ jygH5F90l
+ </saml:NameID>
+ </saml:Subject>
+ <saml:AuthnStatement AuthnInstant="2005-04-01T16:57:30.000Z" SessionIndex="6345789">
+ <saml:AuthnContext>
+ <saml:AuthnContextClassRef>
+ urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
+ </saml:AuthnContextClassRef>
+ </saml:AuthnContext>
+ </saml:AuthnStatement>
+ </saml:Assertion>
+
More information about the jboss-svn-commits
mailing list