You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by gi...@apache.org on 2011/09/18 15:51:36 UTC
svn commit: r1172285 [12/48] - in /webservices/wss4j/branches/swssf: ./
cxf-integration/ cxf-integration/src/ cxf-integration/src/main/
cxf-integration/src/main/java/ cxf-integration/src/main/java/org/
cxf-integration/src/main/java/org/swssf/ cxf-integ...
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/TransformationParametersType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/TransformationParametersType.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/TransformationParametersType.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/TransformationParametersType.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0;
+
+import org.swssf.ext.Constants;
+import org.swssf.ext.ParseException;
+import org.swssf.ext.Parseable;
+import org.swssf.ext.Utils;
+import org.w3._2000._09.xmldsig_.CanonicalizationMethodType;
+import org.w3c.dom.Element;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * This complexType defines a container for elements to be specified from any namespace as properties/parameters of a DSIG transformation.
+ * <p/>
+ * <p>Java class for TransformationParametersType complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="TransformationParametersType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "TransformationParametersType", propOrder = {
+ "any"
+})
+public class TransformationParametersType implements Parseable {
+
+ @XmlAnyElement(lax = true)
+ protected List<Object> any;
+ @XmlAnyAttribute
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ private CanonicalizationMethodType canonicalizationMethodType;
+
+ private Parseable currentParseable;
+
+ public TransformationParametersType(StartElement startElement) {
+ }
+
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ if (currentParseable != null) {
+ boolean finished = currentParseable.parseXMLEvent(xmlEvent);
+ if (finished) {
+ currentParseable.validate();
+ currentParseable = null;
+ }
+ return false;
+ }
+
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ if (startElement.getName().equals(Constants.TAG_dsig_CanonicalizationMethod)) {
+ currentParseable = canonicalizationMethodType = new CanonicalizationMethodType(startElement);
+ } else {
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ currentParseable = null;
+ EndElement endElement = xmlEvent.asEndElement();
+ if (endElement.getName().equals(Constants.TAG_wsse_TransformationParameters)) {
+ return true;
+ }
+ break;
+ //possible ignorable withespace and comments
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.COMMENT:
+ break;
+ default:
+ throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ if (canonicalizationMethodType == null) {
+ throw new ParseException("Element \"CanonicalizationMethodType\" is missing");
+ }
+ }
+
+ /**
+ * Gets the value of the any property.
+ * <p/>
+ * <p/>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the any property.
+ * <p/>
+ * <p/>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getAny().add(newItem);
+ * </pre>
+ * <p/>
+ * <p/>
+ * <p/>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Element }
+ * {@link Object }
+ */
+ public List<Object> getAny() {
+ if (any == null) {
+ any = new ArrayList<Object>();
+ }
+ return this.any;
+ }
+
+ /**
+ * Gets a map that contains attributes that aren't bound to any typed property on this class.
+ * <p/>
+ * <p/>
+ * the map is keyed by the name of the attribute and
+ * the value is the string value of the attribute.
+ * <p/>
+ * the map returned by this method is live, and you can add new attribute
+ * by updating the map directly. Because of this design, there's no setter.
+ *
+ * @return always non-null
+ */
+ public Map<QName, String> getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ public CanonicalizationMethodType getCanonicalizationMethodType() {
+ return canonicalizationMethodType;
+ }
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/TransformationParametersType.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,353 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0;
+
+import org.swssf.ext.Constants;
+import org.swssf.ext.ParseException;
+import org.swssf.ext.Parseable;
+import org.swssf.ext.Utils;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.util.Iterator;
+
+
+/**
+ * This type represents a username token per Section 4.1
+ * <p/>
+ * <p>Java class for UsernameTokenType complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="UsernameTokenType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Username" type="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}AttributedString"/>
+ * <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * <attribute ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id"/>
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "UsernameTokenType", propOrder = {
+ "username",
+ "password",
+ "nonce",
+ "created",
+ "salt",
+ "iteration"
+})
+public class UsernameTokenType implements Parseable {
+
+ @XmlElement(name = "Username", required = true)
+ protected String username;
+ @XmlElement(name = "Password", required = false)
+ protected String password;
+ @XmlAttribute(name = "Type", required = false)
+ protected String passwordType;
+ @XmlElement(name = "Nonce", required = false)
+ protected String nonce;
+ @XmlAttribute(name = "EncodingType", required = false)
+ protected String nonceEncodingType;
+ @XmlElement(name = "Created", required = false)
+ protected String created;
+ @XmlElement(name = "Salt", required = false)
+ protected String salt;
+ @XmlElement(name = "Iteration", required = false)
+ protected String iteration;
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+
+ private QName startElementName;
+ private Parseable currentParseable;
+
+ public UsernameTokenType(StartElement startElement) {
+ this.startElementName = startElement.getName();
+ @SuppressWarnings("unchecked")
+ Iterator<Attribute> attributeIterator = startElement.getAttributes();
+ while (attributeIterator.hasNext()) {
+ Attribute attribute = attributeIterator.next();
+ if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
+ this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
+ }
+ }
+ }
+
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+
+ if (currentParseable != null) {
+ boolean finished = currentParseable.parseXMLEvent(xmlEvent);
+ if (finished) {
+ currentParseable.validate();
+ currentParseable = null;
+ }
+ return false;
+ }
+
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ if (startElement.getName().equals(Constants.TAG_wsse_Username)) {
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ username = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ } else if (startElement.getName().equals(Constants.TAG_wsse_Password)) {
+ Attribute attribute = startElement.getAttributeByName(Constants.ATT_NULL_Type);
+ if (attribute != null) {
+ passwordType = attribute.getValue();
+ }
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ password = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ } else if (startElement.getName().equals(Constants.TAG_wsse_Nonce)) {
+ Attribute attribute = startElement.getAttributeByName(Constants.ATT_NULL_EncodingType);
+ if (attribute != null) {
+ nonceEncodingType = attribute.getValue();
+ }
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ nonce = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ } else if (startElement.getName().equals(Constants.TAG_wsu_Created)) {
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ created = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ } else if (startElement.getName().equals(Constants.TAG_wsse11_Salt)) {
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ salt = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ } else if (startElement.getName().equals(Constants.TAG_wsse11_Iteration)) {
+ currentParseable = new Parseable() {
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ return true;
+ case XMLStreamConstants.CHARACTERS:
+ iteration = xmlEvent.asCharacters().getData();
+ break;
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ }
+ };
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ currentParseable = null;
+ EndElement endElement = xmlEvent.asEndElement();
+ if (endElement.getName().equals(startElementName)) {
+ return true;
+ }
+ break;
+ //possible ignorable withespace and comments
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.COMMENT:
+ break;
+ default:
+ throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ if (username == null) {
+ throw new ParseException("Element \"Username\" is missing");
+ }
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getPasswordType() {
+ return passwordType;
+ }
+
+ public void setPasswordType(String passwordType) {
+ this.passwordType = passwordType;
+ }
+
+ public String getNonce() {
+ return nonce;
+ }
+
+ public void setNonce(String nonce) {
+ this.nonce = nonce;
+ }
+
+ public String getNonceEncodingType() {
+ return nonceEncodingType;
+ }
+
+ public void setNonceEncodingType(String nonceEncodingType) {
+ this.nonceEncodingType = nonceEncodingType;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public String getSalt() {
+ return salt;
+ }
+
+ public void setSalt(String salt) {
+ this.salt = salt;
+ }
+
+ public String getIteration() {
+ return iteration;
+ }
+
+ public void setIteration(String iteration) {
+ this.iteration = iteration;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,172 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0;
+
+import org.swssf.ext.Constants;
+import org.swssf.ext.ParseException;
+import org.swssf.ext.Parseable;
+import org.swssf.ext.Utils;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * This type is for elements whose [children] is a psuedo-dateTime and can have arbitrary attributes.
+ * <p/>
+ * <p/>
+ * <p>Java class for AttributedDateTime complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="AttributedDateTime">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ * <attGroup ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}commonAtts"/>
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AttributedDateTime", propOrder = {
+ "value"
+})
+public class AttributedDateTime implements Parseable {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+ @XmlAnyAttribute
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ private QName startElementName;
+
+ public AttributedDateTime(StartElement startElement) {
+ this.startElementName = startElement.getName();
+ @SuppressWarnings("unchecked")
+ Iterator<Attribute> attributeIterator = startElement.getAttributes();
+ while (attributeIterator.hasNext()) {
+ Attribute attribute = attributeIterator.next();
+ if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
+ this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
+ }
+ }
+ }
+
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ case XMLStreamConstants.END_ELEMENT:
+ EndElement endElement = xmlEvent.asEndElement();
+ if (endElement.getName().equals(this.startElementName)) {
+ return true;
+ }
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ this.value = xmlEvent.asCharacters().getData();
+ break;
+ default:
+ throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ if (value == null) {
+ throw new ParseException("Text-Content of Element \"" + startElementName + "\" is missing");
+ }
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets a map that contains attributes that aren't bound to any typed property on this class.
+ * <p/>
+ * <p/>
+ * the map is keyed by the name of the attribute and
+ * the value is the string value of the attribute.
+ * <p/>
+ * the map returned by this method is live, and you can add new attribute
+ * by updating the map directly. Because of this design, there's no setter.
+ *
+ * @return always non-null
+ */
+ public Map<QName, String> getOtherAttributes() {
+ return otherAttributes;
+ }
+
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedURI.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedURI.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedURI.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedURI.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * This type is for elements whose [children] is an anyURI and can have arbitrary attributes.
+ * <p/>
+ * <p/>
+ * <p>Java class for AttributedURI complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="AttributedURI">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ * <attGroup ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}commonAtts"/>
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AttributedURI", propOrder = {
+ "value"
+})
+public class AttributedURI {
+
+ @XmlValue
+ @XmlSchemaType(name = "anyURI")
+ protected String value;
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+ @XmlAnyAttribute
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets a map that contains attributes that aren't bound to any typed property on this class.
+ * <p/>
+ * <p/>
+ * the map is keyed by the name of the attribute and
+ * the value is the string value of the attribute.
+ * <p/>
+ * the map returned by this method is live, and you can add new attribute
+ * by updating the map directly. Because of this design, there's no setter.
+ *
+ * @return always non-null
+ */
+ public Map<QName, String> getOtherAttributes() {
+ return otherAttributes;
+ }
+
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedURI.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0;
+
+import org.swssf.ext.Constants;
+import org.swssf.ext.ParseException;
+import org.swssf.ext.Parseable;
+import org.swssf.ext.Utils;
+import org.w3c.dom.Element;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.util.*;
+
+
+/**
+ * This complex type ties together the timestamp related elements into a composite type.
+ * <p/>
+ * <p/>
+ * <p>Java class for TimestampType complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="TimestampType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Created" minOccurs="0"/>
+ * <element ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Expires" minOccurs="0"/>
+ * <choice maxOccurs="unbounded" minOccurs="0">
+ * <any processContents='lax' namespace='##other'/>
+ * </choice>
+ * </sequence>
+ * <attGroup ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}commonAtts"/>
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "TimestampType", propOrder = {
+ "created",
+ "expires",
+ "any"
+})
+public class TimestampType implements Parseable {
+
+ private Parseable currentParseable;
+
+ @XmlElement(name = "Created")
+ protected AttributedDateTime created;
+ @XmlElement(name = "Expires")
+ protected AttributedDateTime expires;
+ @XmlAnyElement(lax = true)
+ protected List<Object> any;
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+ @XmlAnyAttribute
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ public TimestampType(StartElement startElement) {
+ @SuppressWarnings("unchecked")
+ Iterator<Attribute> attributeIterator = startElement.getAttributes();
+ while (attributeIterator.hasNext()) {
+ Attribute attribute = attributeIterator.next();
+ if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
+ this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
+ }
+ }
+ }
+
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ if (currentParseable != null) {
+ boolean finished = currentParseable.parseXMLEvent(xmlEvent);
+ if (finished) {
+ currentParseable.validate();
+ currentParseable = null;
+ }
+ return false;
+ }
+
+ switch (xmlEvent.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ StartElement startElement = xmlEvent.asStartElement();
+
+ if (startElement.getName().equals(Constants.TAG_wsu_Created)) {
+ currentParseable = this.created = new AttributedDateTime(startElement);
+ } else if (startElement.getName().equals(Constants.TAG_wsu_Expires)) {
+ currentParseable = this.expires = new AttributedDateTime(startElement);
+ } else {
+ throw new ParseException("Unsupported Element: " + startElement.getName());
+ }
+
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ currentParseable = null;
+ EndElement endElement = xmlEvent.asEndElement();
+ if (endElement.getName().equals(Constants.TAG_wsu_Timestamp)) {
+ return true;
+ }
+ break;
+ default:
+ throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ }
+ return false;
+ }
+
+ public void validate() throws ParseException {
+ //I think this could be an interesting case
+ //the spec says both elements are optional.
+ //wss4j doesn't check if the Timestamp has child elements
+ //and just expects the Timestamp element itself (Timestamp-Action).
+ //this is not enough.
+ //Since we don't handle custom Timestamp elements, we force
+ //here the existence of the created Element.
+ if (created == null) {
+ throw new ParseException("Element \"Created\" is missing");
+ }
+ }
+
+ /**
+ * Gets the value of the created property.
+ *
+ * @return possible object is
+ * {@link AttributedDateTime }
+ */
+ public AttributedDateTime getCreated() {
+ return created;
+ }
+
+ /**
+ * Sets the value of the created property.
+ *
+ * @param value allowed object is
+ * {@link AttributedDateTime }
+ */
+ public void setCreated(AttributedDateTime value) {
+ this.created = value;
+ }
+
+ /**
+ * Gets the value of the expires property.
+ *
+ * @return possible object is
+ * {@link AttributedDateTime }
+ */
+ public AttributedDateTime getExpires() {
+ return expires;
+ }
+
+ /**
+ * Sets the value of the expires property.
+ *
+ * @param value allowed object is
+ * {@link AttributedDateTime }
+ */
+ public void setExpires(AttributedDateTime value) {
+ this.expires = value;
+ }
+
+ /**
+ * Gets the value of the any property.
+ * <p/>
+ * <p/>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the any property.
+ * <p/>
+ * <p/>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getAny().add(newItem);
+ * </pre>
+ * <p/>
+ * <p/>
+ * <p/>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Element }
+ * {@link Object }
+ */
+ public List<Object> getAny() {
+ if (any == null) {
+ any = new ArrayList<Object>();
+ }
+ return this.any;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets a map that contains attributes that aren't bound to any typed property on this class.
+ * <p/>
+ * <p/>
+ * the map is keyed by the name of the attribute and
+ * the value is the string value of the attribute.
+ * <p/>
+ * the map returned by this method is live, and you can add new attribute
+ * by updating the map directly. Because of this design, there's no setter.
+ *
+ * @return always non-null
+ */
+ public Map<QName, String> getOtherAttributes() {
+ return otherAttributes;
+ }
+
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/EncryptedHeaderType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/EncryptedHeaderType.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/EncryptedHeaderType.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/EncryptedHeaderType.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,199 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss.oasis_wss_wssecurity_secext_1_1;
+
+import org.w3._2001._04.xmlenc_.EncryptedDataType;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ * <p>Java class for EncryptedHeaderType complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="EncryptedHeaderType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element ref="{http://www.w3.org/2001/04/xmlenc#}EncryptedData"/>
+ * </sequence>
+ * <attribute ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id"/>
+ * <attribute ref="{http://schemas.xmlsoap.org/soap/envelope/}mustUnderstand"/>
+ * <attribute ref="{http://schemas.xmlsoap.org/soap/envelope/}actor"/>
+ * <attribute ref="{http://www.w3.org/2003/05/soap-envelope}role"/>
+ * <attribute ref="{http://www.w3.org/2003/05/soap-envelope}relay"/>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "EncryptedHeaderType", namespace = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", propOrder = {
+ "encryptedData"
+})
+
+public class EncryptedHeaderType {
+
+ @XmlElement(name = "EncryptedData", namespace = "http://www.w3.org/2001/04/xmlenc#", required = true)
+ protected EncryptedDataType encryptedData;
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+ @XmlAttribute(namespace = "http://schemas.xmlsoap.org/soap/envelope/")
+ protected Boolean mustUnderstand;
+ @XmlAttribute(namespace = "http://schemas.xmlsoap.org/soap/envelope/")
+ @XmlSchemaType(name = "anyURI")
+ protected String actor;
+ @XmlAttribute(namespace = "http://www.w3.org/2003/05/soap-envelope")
+ @XmlSchemaType(name = "anyURI")
+ protected String role;
+ @XmlAttribute(namespace = "http://www.w3.org/2003/05/soap-envelope")
+ protected Boolean relay;
+
+ /**
+ * Gets the value of the encryptedData property.
+ *
+ * @return possible object is
+ * {@link EncryptedDataType }
+ */
+ public EncryptedDataType getEncryptedData() {
+ return encryptedData;
+ }
+
+ /**
+ * Sets the value of the encryptedData property.
+ *
+ * @param value allowed object is
+ * {@link EncryptedDataType }
+ */
+ public void setEncryptedData(EncryptedDataType value) {
+ this.encryptedData = value;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the mustUnderstand property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public Boolean isMustUnderstand() {
+ return mustUnderstand;
+ }
+
+ /**
+ * Sets the value of the mustUnderstand property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setMustUnderstand(Boolean value) {
+ this.mustUnderstand = value;
+ }
+
+ /**
+ * Gets the value of the actor property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getActor() {
+ return actor;
+ }
+
+ /**
+ * Sets the value of the actor property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setActor(String value) {
+ this.actor = value;
+ }
+
+ /**
+ * Gets the value of the role property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getRole() {
+ return role;
+ }
+
+ /**
+ * Sets the value of the role property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setRole(String value) {
+ this.role = value;
+ }
+
+ /**
+ * Gets the value of the relay property.
+ *
+ * @return possible object is
+ * {@link Boolean }
+ */
+ public boolean isRelay() {
+ if (relay == null) {
+ return false;
+ } else {
+ return relay;
+ }
+ }
+
+ /**
+ * Sets the value of the relay property.
+ *
+ * @param value allowed object is
+ * {@link Boolean }
+ */
+ public void setRelay(Boolean value) {
+ this.relay = value;
+ }
+
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/EncryptedHeaderType.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,131 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.oasis_open.docs.wss.oasis_wss_wssecurity_secext_1_1;
+
+import org.apache.commons.codec.binary.Base64;
+import org.swssf.ext.Constants;
+import org.swssf.ext.ParseException;
+import org.swssf.ext.Parseable;
+import org.swssf.ext.Utils;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.util.Iterator;
+
+
+/**
+ * <p>Java class for SignatureConfirmationType complex type.
+ * <p/>
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p/>
+ * <pre>
+ * <complexType name="SignatureConfirmationType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute ref="{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id"/>
+ * <attribute name="Value" use="required" type="{http://www.w3.org/2001/XMLSchema}base64Binary" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "SignatureConfirmationType", namespace = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd")
+public class SignatureConfirmationType implements Parseable {
+
+ @XmlAttribute(name = "Id", namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlID
+ @XmlSchemaType(name = "ID")
+ protected String id;
+ @XmlAttribute(name = "Value", required = true)
+ protected byte[] value;
+
+ private StartElement startElement;
+
+ public SignatureConfirmationType(StartElement startElement) {
+ super();
+ this.startElement = startElement;
+ @SuppressWarnings("unchecked")
+ Iterator<Attribute> attributeIterator = startElement.getAttributes();
+ while (attributeIterator.hasNext()) {
+ Attribute attribute = attributeIterator.next();
+ if (attribute.getName().equals(Constants.ATT_NULL_Value)) {
+ this.value = Base64.decodeBase64(attribute.getValue());
+ } else if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ this.id = attribute.getValue();
+ }
+ }
+ }
+
+ public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
+ if (!xmlEvent.isEndElement() && xmlEvent.asEndElement().getName().equals(this.startElement.getName())) {
+ throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ }
+ return true;
+ }
+
+ public void validate() throws ParseException {
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is
+ * {@link String }
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is
+ * {@link String }
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return possible object is
+ * byte[]
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value allowed object is
+ * byte[]
+ */
+ public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,347 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf;
+
+import org.swssf.config.Init;
+import org.swssf.ext.*;
+
+import java.security.Provider;
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is the central class of the streaming webservice-security framework.<br/>
+ * Instances of the inbound and outbound security streams can be retrieved
+ * with this class.
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class WSSec {
+
+ //todo crl check
+ //todo outgoing client setup per policy
+
+ static {
+ try {
+ Class c = WSSec.class.getClassLoader().loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
+ if (null == Security.getProvider("BC")) {
+ int i = Security.addProvider((Provider) c.newInstance());
+ }
+ } catch (Throwable e) {
+ throw new RuntimeException("Adding BouncyCastle provider failed", e);
+ }
+ }
+
+ /**
+ * Creates and configures an outbound streaming security engine
+ *
+ * @param securityProperties The user-defined security configuration
+ * @return A new OutboundWSSec
+ * @throws org.swssf.ext.WSSecurityException
+ * if the initialisation failed
+ * @throws org.swssf.ext.WSSConfigurationException
+ * if the configuration is invalid
+ */
+ public static OutboundWSSec getOutboundWSSec(SecurityProperties securityProperties) throws WSSecurityException {
+ if (securityProperties == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
+ }
+
+ Init.init(null);
+
+ securityProperties = validateAndApplyDefaultsToOutboundSecurityProperties(securityProperties);
+ return new OutboundWSSec(securityProperties);
+ }
+
+ /**
+ * Creates and configures an inbound streaming security engine
+ *
+ * @param securityProperties The user-defined security configuration
+ * @return A new InboundWSSec
+ * @throws org.swssf.ext.WSSecurityException
+ * if the initialisation failed
+ * @throws org.swssf.ext.WSSConfigurationException
+ * if the configuration is invalid
+ */
+ public static InboundWSSec getInboundWSSec(SecurityProperties securityProperties) throws WSSecurityException {
+ if (securityProperties == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
+ }
+
+ Init.init(null);
+
+ securityProperties = validateAndApplyDefaultsToInboundSecurityProperties(securityProperties);
+ return new InboundWSSec(securityProperties);
+ }
+
+ /**
+ * Validates the user supplied configuration and applies default values as apropriate for the outbound security engine
+ *
+ * @param securityProperties The configuration to validate
+ * @return The validated configuration
+ * @throws org.swssf.ext.WSSConfigurationException
+ * if the configuration is invalid
+ */
+ public static SecurityProperties validateAndApplyDefaultsToOutboundSecurityProperties(SecurityProperties securityProperties) throws WSSConfigurationException {
+ if (securityProperties.getOutAction() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noOutputAction");
+ }
+
+ //todo encrypt sigconf when original signature was encrypted
+ int pos = Arrays.binarySearch(securityProperties.getOutAction(), Constants.Action.SIGNATURE_CONFIRMATION);
+ if (pos >= 0) {
+ if (Arrays.binarySearch(securityProperties.getOutAction(), Constants.Action.SIGNATURE) < 0) {
+ List<Constants.Action> actionList = new ArrayList<Constants.Action>(securityProperties.getOutAction().length);
+ actionList.addAll(Arrays.asList(securityProperties.getOutAction()));
+ actionList.add(pos, Constants.Action.SIGNATURE);
+ securityProperties.setOutAction(actionList.toArray(new Constants.Action[securityProperties.getOutAction().length + 1]));
+ }
+ }
+
+ for (int i = 0; i < securityProperties.getOutAction().length; i++) {
+ Constants.Action action = securityProperties.getOutAction()[i];
+ switch (action) {
+ case TIMESTAMP:
+ if (securityProperties.getTimestampTTL() == null) {
+ securityProperties.setTimestampTTL(300);
+ }
+ break;
+ case SIGNATURE:
+ if (securityProperties.getSignatureKeyStore() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "signatureKeyStoreNotSet");
+ }
+ if (securityProperties.getSignatureUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noSignatureUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ if (securityProperties.getSignatureKeyIdentifierType() == null) {
+ securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.ISSUER_SERIAL);
+ }
+ break;
+
+ case ENCRYPT:
+ if (securityProperties.getEncryptionUseThisCertificate() == null
+ && securityProperties.getEncryptionKeyStore() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
+ }
+ if (securityProperties.getEncryptionUser() == null
+ && securityProperties.getEncryptionUseThisCertificate() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
+ }
+ //encryption namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getEncryptionSecureParts().isEmpty()) {
+ securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
+ }
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.ISSUER_SERIAL);
+ }
+ break;
+ case USERNAMETOKEN:
+ if (securityProperties.getTokenUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ if (securityProperties.getUsernameTokenPasswordType() == null) {
+ securityProperties.setUsernameTokenPasswordType(Constants.UsernameTokenPasswordType.PASSWORD_DIGEST);
+ }
+ break;
+ case USERNAMETOKEN_SIGNED:
+ if (securityProperties.getTokenUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.USERNAMETOKEN_REFERENCE);
+ if (securityProperties.getUsernameTokenPasswordType() == null) {
+ securityProperties.setUsernameTokenPasswordType(Constants.UsernameTokenPasswordType.PASSWORD_DIGEST);
+ }
+ break;
+ case SIGNATURE_CONFIRMATION:
+ securityProperties.addSignaturePart(new SecurePart(Constants.TAG_wsse11_SignatureConfirmation.getLocalPart(), Constants.TAG_wsse11_SignatureConfirmation.getNamespaceURI(), SecurePart.Modifier.Element));
+ break;
+ case SIGNATURE_WITH_DERIVED_KEY:
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
+ securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() == null) {
+ securityProperties.setDerivedKeyTokenReference(Constants.DerivedKeyTokenReference.DirectReference);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() != Constants.DerivedKeyTokenReference.DirectReference) {
+ securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ break;
+ case ENCRYPT_WITH_DERIVED_KEY:
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ if (securityProperties.getEncryptionUseThisCertificate() == null
+ && securityProperties.getEncryptionKeyStore() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
+ }
+ if (securityProperties.getEncryptionUser() == null
+ && securityProperties.getEncryptionUseThisCertificate() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
+ }
+ //encryption namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getEncryptionSecureParts().isEmpty()) {
+ securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
+ }
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
+ securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() == null) {
+ securityProperties.setDerivedKeyTokenReference(Constants.DerivedKeyTokenReference.EncryptedKey);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() != Constants.DerivedKeyTokenReference.DirectReference) {
+ securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ break;
+ case SAML_TOKEN_SIGNED:
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ if (securityProperties.getSignatureKeyIdentifierType() == null) {
+ securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ break;
+ case SAML_TOKEN_UNSIGNED:
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ break;
+ }
+ }
+ //todo clone securityProperties
+ return securityProperties;
+ }
+
+ /**
+ * Validates the user supplied configuration and applies default values as apropriate for the inbound security engine
+ *
+ * @param securityProperties The configuration to validate
+ * @return The validated configuration
+ * @throws org.swssf.ext.WSSConfigurationException
+ * if the configuration is invalid
+ */
+ public static SecurityProperties validateAndApplyDefaultsToInboundSecurityProperties(SecurityProperties securityProperties) throws WSSConfigurationException {
+ //todo clone securityProperties
+ return securityProperties;
+ }
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/ConfigurationProperties.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/ConfigurationProperties.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/ConfigurationProperties.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/ConfigurationProperties.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.config;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xmlsecurity.ns.configuration.PropertiesType;
+import org.xmlsecurity.ns.configuration.PropertyType;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Configuration Properties
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class ConfigurationProperties {
+
+ private static final transient Log logger = LogFactory.getLog(ConfigurationProperties.class);
+
+ private static Properties properties;
+
+ private ConfigurationProperties() {
+ super();
+ }
+
+ protected static void init(PropertiesType propertiesType) throws Exception {
+ properties = new Properties();
+ List<PropertyType> handlerList = propertiesType.getProperty();
+ for (int i = 0; i < handlerList.size(); i++) {
+ PropertyType propertyType = handlerList.get(i);
+ properties.setProperty(propertyType.getNAME(), propertyType.getVAL());
+ }
+ }
+
+ public static String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/ConfigurationProperties.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/Init.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/Init.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/Init.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/Init.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.config;
+
+import org.swssf.ext.WSSConfigurationException;
+import org.swssf.ext.WSSecurityException;
+import org.xmlsecurity.ns.configuration.ConfigurationType;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.net.URL;
+
+/**
+ * Class to load the algorithms-mappings from a configuration file.
+ * After the initialization the mapping is available through the JCEAlgorithmMapper
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class Init {
+
+ private static String initialized = null;
+
+ @SuppressWarnings("unchecked")
+ public synchronized static void init(URL url) throws WSSecurityException {
+ if (initialized == null || (url != null && !url.toExternalForm().equals(initialized))) {
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance("org.xmlsecurity.ns.configuration");
+ final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(Init.class.getClassLoader().getResource("security-config.xsd"));
+ unmarshaller.setSchema(schema);
+ JAXBElement<ConfigurationType> configurationTypeJAXBElement;
+ if (url != null) {
+ configurationTypeJAXBElement = (JAXBElement<ConfigurationType>) unmarshaller.unmarshal(url);
+ } else {
+ configurationTypeJAXBElement = (JAXBElement<ConfigurationType>) unmarshaller.unmarshal(Init.class.getClassLoader().getResourceAsStream("security-config.xml"));
+ }
+
+ ConfigurationProperties.init(configurationTypeJAXBElement.getValue().getProperties());
+ SecurityHeaderHandlerMapper.init(configurationTypeJAXBElement.getValue().getSecurityHeaderHandlers());
+ JCEAlgorithmMapper.init(configurationTypeJAXBElement.getValue().getJCEAlgorithmMappings());
+ TransformerAlgorithmMapper.init(configurationTypeJAXBElement.getValue().getTransformAlgorithms());
+
+ } catch (Exception e) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, null, e);
+ }
+ initialized = "security-config.xml";
+ }
+ }
+}
Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/config/Init.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision