Author: maeste
Date: 2007-05-09 12:02:45 -0400 (Wed, 09 May 2007)
New Revision: 3018
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/security/SecurityStore.java
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/META-INF/wsdl/HelloService.wsdl
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl
Log:
Sample works!
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-09
12:50:02 UTC (rev 3017)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-09
16:02:45 UTC (rev 3018)
@@ -22,7 +22,6 @@
public void deploy(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData)
throws UnsupportedAssertion
{
- System.out.print("#########################");
StringWriter writer = new StringWriter();
if (extMetaData instanceof EndpointMetaData)
{
@@ -40,11 +39,11 @@
securityConfiguration = WSSecurityOMFactory.newInstance().parse(reader);
WSSecurityConfigFactory.newInstance().initKeystorePath(ep.getRootFile(),
securityConfiguration);
ep.getServiceMetaData().setSecurityConfiguration(securityConfiguration);
+
//set up handler chain as defined in standard file
ep.setConfigName("Standard WSSecurity Endpoint");
ep.initEndpointConfig();
-
-
System.out.print("-----------#########################-------------");
+
}
catch (Exception e)
{
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java 2007-05-09
12:50:02 UTC (rev 3017)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java 2007-05-09
16:02:45 UTC (rev 3018)
@@ -1,88 +1,109 @@
-
package org.jboss.ws.extensions.policy.deployer.util;
import java.io.StringWriter;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.PrimitiveAssertion;
+public class PrimitiveAssertionWriter
+{
-public class PrimitiveAssertionWriter {
+ private int num = 1;
- private int num = 1;
+ PrimitiveAssertionWriter()
+ {
+ }
- PrimitiveAssertionWriter() {
- }
-
- public static PrimitiveAssertionWriter newInstance()
+ public static PrimitiveAssertionWriter newInstance()
{
- return new PrimitiveAssertionWriter();
+ return new PrimitiveAssertionWriter();
}
- public void writePrimitiveAssertion(PrimitiveAssertion assertion,
- StringWriter stringWriter) throws XMLStreamException {
-
+ public void writePrimitiveAssertion(PrimitiveAssertion assertion, StringWriter
stringWriter) throws XMLStreamException
+ {
XMLStreamWriter writer =
XMLOutputFactory.newInstance().createXMLStreamWriter(stringWriter);
+ writePrimitiveAssertion(assertion, writer);
- QName qname = assertion.getName();
+ }
+ public void writePrimitiveAssertion(PrimitiveAssertion assertion, XMLStreamWriter
writer) throws XMLStreamException
+ {
- String writerPrefix = writer.getPrefix(qname.getNamespaceURI());
- if (writerPrefix != null) {
- writer.writeStartElement(qname.getNamespaceURI(), qname
- .getLocalPart());
- } else {
- String prefix = (qname.getPrefix() != null) ? qname.getPrefix()
- : generateNamespace();
- writer.writeStartElement(prefix, qname.getLocalPart(), qname
- .getNamespaceURI());
- writer.writeNamespace(prefix, qname.getNamespaceURI());
- writer.setPrefix(prefix, qname.getNamespaceURI());
+
- }
+ QName qname = assertion.getName();
- Hashtable attributes = assertion.getAttributes();
- writeAttributes(attributes, writer);
+ String writerPrefix = writer.getPrefix(qname.getNamespaceURI());
+ if (writerPrefix != null)
+ {
+ writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart());
+ }
+ else
+ {
+ String prefix = (qname.getPrefix() != null) ? qname.getPrefix() :
generateNamespace();
+ writer.writeStartElement(prefix, qname.getLocalPart(),
qname.getNamespaceURI());
+ writer.writeNamespace(prefix, qname.getNamespaceURI());
+ writer.setPrefix(prefix, qname.getNamespaceURI());
- String text = (String) assertion.getStrValue();
- if (text != null) {
- writer.writeCharacters(text);
- }
+ }
+ Hashtable attributes = assertion.getAttributes();
+ writeAttributes(attributes, writer);
+
+ String text = (String)assertion.getStrValue();
+ if (text != null)
+ {
+ writer.writeCharacters(text);
+ }
+
//A Primitive assertion can't have terms----to be verified
-// List terms = assertion.getTerms();
-// writeTerms(terms, writer);
+ List terms = assertion.getTerms();
+ writeTerms(terms, writer);
- writer.writeEndElement();
- }
+ writer.writeEndElement();
+ }
-
+ private void writeTerms(List terms, XMLStreamWriter writer) throws XMLStreamException
+ {
- private void writeAttributes(Hashtable attributes, XMLStreamWriter writer)
- throws XMLStreamException {
+ Iterator iterator = terms.iterator();
+ while (iterator.hasNext())
+ {
+ Assertion assertion = (Assertion)iterator.next();
+ writePrimitiveAssertion((PrimitiveAssertion) assertion, writer);
+ }
+ }
- Iterator iterator = attributes.keySet().iterator();
- while (iterator.hasNext()) {
- QName qname = (QName) iterator.next();
- String value = (String) attributes.get(qname);
+ private void writeAttributes(Hashtable attributes, XMLStreamWriter writer) throws
XMLStreamException
+ {
- String prefix = qname.getPrefix();
- if (prefix != null) {
- writer.writeAttribute(prefix, qname.getNamespaceURI(), qname
- .getLocalPart(), value);
- } else {
- writer.writeAttribute(qname.getNamespaceURI(), qname
- .getLocalPart(), value);
- }
- }
- }
+ Iterator iterator = attributes.keySet().iterator();
+ while (iterator.hasNext())
+ {
+ QName qname = (QName)iterator.next();
+ String value = (String)attributes.get(qname);
- private String generateNamespace() {
- return "ns" + num++;
- }
+ String prefix = qname.getPrefix();
+ if (prefix != null)
+ {
+ writer.writeAttribute(prefix, qname.getNamespaceURI(), qname.getLocalPart(),
value);
+ }
+ else
+ {
+ writer.writeAttribute(qname.getNamespaceURI(), qname.getLocalPart(), value);
+ }
+ }
+ }
+
+ private String generateNamespace()
+ {
+ return "ns" + num++;
+ }
}
\ No newline at end of file
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/security/SecurityStore.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/security/SecurityStore.java 2007-05-09
12:50:02 UTC (rev 3017)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/security/SecurityStore.java 2007-05-09
16:02:45 UTC (rev 3018)
@@ -298,6 +298,7 @@
X509Certificate cert;
try
{
+ log.info("ALIAS:" + alias);
cert = (X509Certificate)keyStore.getCertificate(alias);
}
catch (Exception e)
Modified:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/META-INF/wsdl/HelloService.wsdl
===================================================================
---
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/META-INF/wsdl/HelloService.wsdl 2007-05-09
12:50:02 UTC (rev 3017)
+++
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/META-INF/wsdl/HelloService.wsdl 2007-05-09
16:02:45 UTC (rev 3018)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<definitions name='HelloService'
targetNamespace='http://org.jboss.ws/samples/wssecuritypolicy'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.ws/samples/wssecuritypolicy'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+<definitions name='HelloService'
targetNamespace='http://org.jboss.ws/samples/wssecurity'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.ws/samples/wssecurity'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
- <xs:schema targetNamespace='http://org.jboss.ws/samples/wssecuritypolicy'
version='1.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:schema targetNamespace='http://org.jboss.ws/samples/wssecurity'
version='1.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:complexType name='UserType'>
<xs:sequence>
<xs:element minOccurs='0' name='msg'
type='xs:string'/>
@@ -38,4 +38,4 @@
<soap:address location='REPLACE_WITH_ACTUAL_URL'/>
</port>
</service>
-</definitions>
+</definitions>
\ No newline at end of file
Modified:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl
===================================================================
---
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl 2007-05-09
12:50:02 UTC (rev 3017)
+++
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl 2007-05-09
16:02:45 UTC (rev 3018)
@@ -18,7 +18,7 @@
<sp:trust-store-file>WEB-INF/wsse.truststore</sp:trust-store-file>
<sp:trust-store-password>jbossws</sp:trust-store-password>
<sp:config>
- <sp:encrypt sp:type="x509v3" sp:alias="wsse"/>
+ <sp:encrypt type="x509v3" alias="wsse"/>
<sp:requires>
<sp:encryption/>
</sp:requires>