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/12/04 21:33:12 UTC
svn commit: r1210203 [10/16] - in
/webservices/wss4j/branches/swssf/rampart-policy: ./
src/main/java/META-INF/ src/main/java/org/apache/ws/secpolicy/
src/main/java/org/apache/ws/secpolicy/builders/
src/main/java/org/apache/ws/secpolicy/model/ src/main/...
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportBinding.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportBinding.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportBinding.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportBinding.java Sun Dec 4 20:33:05 2011
@@ -1,209 +1,88 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.apache.ws.secpolicy.model;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+import org.apache.ws.secpolicy.SPConstants;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import java.util.Iterator;
+import java.util.List;
-import org.apache.neethi.All;
-import org.apache.neethi.ExactlyOne;
-import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.SP12Constants;
-
-public class TransportBinding extends Binding {
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class TransportBinding extends AbstractBinding {
private TransportToken transportToken;
- private List transportBindings;
-
- private boolean tokenProtection;
-
- public TransportBinding(int version) {
- super(version);
- this.tokenProtection = false;
- }
- /**
- * @return Returns the transportToken.
- */
- public TransportToken getTransportToken() {
- return transportToken;
- }
-
- /**
- * @param transportToken
- * The transportToken to set.
- */
- public void setTransportToken(TransportToken transportToken) {
- this.transportToken = transportToken;
- }
-
- /**
- * @return Returns the tokenProtection.
- */
- public boolean isTokenProtection() {
- return tokenProtection;
- }
-
- /**
- * @param tokenProtection The tokenProtection to set.
- */
- public void setTokenProtection(boolean tokenProtection) {
- this.tokenProtection = tokenProtection;
- }
-
-
- public List getConfigurations() {
- return transportBindings;
- }
+ public TransportBinding(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version, nestedPolicy);
- public TransportBinding getDefaultConfiguration() {
- if (transportBindings != null) {
- return (TransportBinding) transportBindings.get(0);
- }
- return null;
- }
-
- public void addConfiguration(TransportBinding transportBinding) {
- if (transportBindings == null) {
- transportBindings = new ArrayList();
- }
- transportBindings.add(transportBinding);
+ parseNestedPolicy(nestedPolicy, this);
}
public QName getName() {
- if (version == SPConstants.SP_V12) {
- return SP12Constants.TRANSPORT_BINDING;
- } else {
- return SP11Constants.TRANSPORT_BINDING;
- }
+ return getVersion().getSPConstants().getTransportBinding();
}
- public PolicyComponent normalize() {
- if (isNormalized()) {
- return this;
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new TransportBinding(getVersion(), nestedPolicy);
+ }
+
+ protected void parseNestedPolicy(Policy nestedPolicy, TransportBinding transportBinding) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ if (getVersion().getSPConstants().getTransportToken().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getTransportToken().getNamespaceURI().equals(assertionNamespace)) {
+ if (transportBinding.getTransportToken() != null) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ transportBinding.setTransportToken((TransportToken) assertion);
+ continue;
+ }
+ }
}
-
- AlgorithmSuite algorithmSuite = getAlgorithmSuite();
- List configurations = algorithmSuite.getConfigurations();
-
- if (configurations != null && configurations.size() == 1) {
- setNormalized(true);
- return this;
- }
-
- Policy policy = new Policy();
- ExactlyOne exactlyOne = new ExactlyOne();
-
- All wrapper;
- TransportBinding transportBinding;
-
- for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
- wrapper = new All();
- transportBinding = new TransportBinding(this.getVersion());
-
- algorithmSuite = (AlgorithmSuite) iterator.next();
- transportBinding.setAlgorithmSuite(algorithmSuite);
- transportBinding.setIncludeTimestamp(isIncludeTimestamp());
- transportBinding.setLayout(getLayout());
- transportBinding
- .setSignedEndorsingSupportingTokens(getSignedEndorsingSupportingTokens());
- transportBinding
- .setSignedSupportingToken(getSignedSupportingToken());
- transportBinding.setTransportToken(getTransportToken());
-
- wrapper.addPolicyComponent(transportBinding);
- exactlyOne.addPolicyComponent(wrapper);
- }
-
- policy.addPolicyComponent(exactlyOne);
- return policy;
}
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- String localName = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
-
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
-
- // <sp:TransportBinding>
- writer.writeStartElement(prefix, localName, namespaceURI);
- writer.writeNamespace(prefix, namespaceURI);
-
- String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
- if (pPrefix == null) {
- pPrefix = SPConstants.POLICY.getPrefix();
- writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
-
- if (transportToken == null) {
- // TODO more meaningful exception
- throw new RuntimeException("no TransportToken found");
- }
-
- // <sp:TransportToken>
- transportToken.serialize(writer);
- // </sp:TransportToken>
-
- AlgorithmSuite algorithmSuite = getAlgorithmSuite();
- if (algorithmSuite == null) {
- throw new RuntimeException("no AlgorithmSuite found");
- }
-
- // <sp:AlgorithmSuite>
- algorithmSuite.serialize(writer);
- // </sp:AlgorithmSuite>
-
- Layout layout = getLayout();
- if (layout != null) {
- // <sp:Layout>
- layout.serialize(writer);
- // </sp:Layout>
- }
-
- if (isIncludeTimestamp()) {
- // <sp:IncludeTimestamp>
- writer.writeStartElement(prefix, SPConstants.INCLUDE_TIMESTAMP, namespaceURI);
- writer.writeEndElement();
- // </sp:IncludeTimestamp>
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
- // </sp:TransportBinding>
- writer.writeEndElement();
+ super.serialize(writer, getPolicy());
+ }
+ public TransportToken getTransportToken() {
+ return transportToken;
}
+ protected void setTransportToken(TransportToken transportToken) {
+ this.transportToken = transportToken;
+ }
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportBinding.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportToken.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportToken.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportToken.java Sun Dec 4 20:33:05 2011
@@ -1,110 +1,44 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.apache.ws.secpolicy.model;
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
+import org.apache.neethi.Policy;
import org.apache.ws.secpolicy.SPConstants;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-
-public class TransportToken extends AbstractSecurityAssertion implements TokenWrapper {
-
- private Token transportToken;
-
- public TransportToken(int version){
- setVersion(version);
- }
-
- /**
- * @return Returns the transportToken.
- */
- public Token getTransportToken() {
- return transportToken;
- }
-
- public QName getName() {
- if ( version == SPConstants.SP_V12) {
- return SP12Constants.TRANSPORT_TOKEN;
- } else {
- return SP11Constants.TRANSPORT_TOKEN;
- }
- }
-
- public boolean isOptional() {
- throw new UnsupportedOperationException();
- }
- public PolicyComponent normalize() {
- throw new UnsupportedOperationException();
- }
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class TransportToken extends AbstractTokenWrapper {
- public short getType() {
- return org.apache.neethi.Constants.TYPE_ASSERTION;
+ public TransportToken(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version, nestedPolicy);
}
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-
- String localName = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
-
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
-
- // <sp:TransportToken>
-
- writer.writeStartElement(prefix, localName, namespaceURI);
-
- String wspPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
- if (wspPrefix == null) {
- wspPrefix = SPConstants.POLICY.getPrefix();
- writer.setPrefix(wspPrefix, SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
- // serialization of the token ..
- if (transportToken != null) {
- transportToken.serialize(writer);
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
-
- writer.writeEndElement();
- // </sp:TransportToken>
+ public QName getName() {
+ return getVersion().getSPConstants().getTransportToken();
}
- /* (non-Javadoc)
- * @see org.apache.ws.secpolicy.model.TokenWrapper#setToken(org.apache.ws.secpolicy.model.Token)
- */
- public void setToken(Token tok) {
- this.transportToken = tok;
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new TransportToken(getVersion(), nestedPolicy);
}
-
-
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/TransportToken.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust10.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust10.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust10.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust10.java Sun Dec 4 20:33:05 2011
@@ -1,204 +1,168 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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
+/**
+ * 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
+ * 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.
+ * 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.apache.ws.secpolicy.model;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
+import org.apache.ws.secpolicy.SPConstants;
+
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.SP12Constants;
+import java.util.Iterator;
+import java.util.List;
/**
- * Model bean to capture Trust10 assertion info
+ * @author $Author$
+ * @version $Revision$ $Date$
*/
-public class Trust10 extends AbstractSecurityAssertion {
+public class Trust10 extends AbstractSecurityAssertion implements PolicyContainingAssertion {
+ private Policy nestedPolicy;
private boolean mustSupportClientChallenge;
private boolean mustSupportServerChallenge;
private boolean requireClientEntropy;
private boolean requireServerEntropy;
private boolean mustSupportIssuedTokens;
-
- public Trust10(int version){
- setVersion(version);
- }
-
- /**
- * @return Returns the mustSupportClientChallenge.
- */
- public boolean isMustSupportClientChallenge() {
- return mustSupportClientChallenge;
+
+ public Trust10(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version);
+ this.nestedPolicy = nestedPolicy;
+
+ parseNestedTrust10Policy(nestedPolicy, this);
}
- /**
- * @param mustSupportClientChallenge The mustSupportClientChallenge to set.
- */
- public void setMustSupportClientChallenge(boolean mustSupportClientChallenge) {
- this.mustSupportClientChallenge = mustSupportClientChallenge;
+ public Policy getPolicy() {
+ return nestedPolicy;
}
- /**
- * @return Returns the mustSupportIssuedTokens.
- */
- public boolean isMustSupportIssuedTokens() {
- return mustSupportIssuedTokens;
+ public QName getName() {
+ return getVersion().getSPConstants().getTrust10();
}
- /**
- * @param mustSupportIssuedTokens The mustSupportIssuedTokens to set.
- */
- public void setMustSupportIssuedTokens(boolean mustSupportIssuedTokens) {
- this.mustSupportIssuedTokens = mustSupportIssuedTokens;
+ public PolicyComponent normalize() {
+ return super.normalize(getPolicy());
+ }
+
+ public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+ super.serialize(writer, getPolicy());
+ }
+
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new Trust10(getVersion(), nestedPolicy);
+ }
+
+ protected void parseNestedTrust10Policy(Policy nestedPolicy, Trust10 trust10) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ if (getVersion().getSPConstants().getMustSupportClientChallenge().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportClientChallenge().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust10.isMustSupportClientChallenge()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust10.setMustSupportClientChallenge(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportServerChallenge().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportServerChallenge().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust10.isMustSupportServerChallenge()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust10.setMustSupportServerChallenge(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getRequireClientEntropy().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getRequireClientEntropy().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust10.isRequireClientEntropy()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust10.setRequireClientEntropy(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getRequireServerEntropy().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getRequireServerEntropy().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust10.isRequireServerEntropy()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust10.setRequireServerEntropy(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportIssuedTokens().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportIssuedTokens().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust10.isMustSupportIssuedTokens()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust10.setMustSupportIssuedTokens(true);
+ continue;
+ }
+ }
+ }
+ }
+
+ public boolean isMustSupportClientChallenge() {
+ return mustSupportClientChallenge;
+ }
+
+ protected void setMustSupportClientChallenge(boolean mustSupportClientChallenge) {
+ this.mustSupportClientChallenge = mustSupportClientChallenge;
}
- /**
- * @return Returns the mustSupportServerChallenge.
- */
public boolean isMustSupportServerChallenge() {
return mustSupportServerChallenge;
}
- /**
- * @param mustSupportServerChallenge The mustSupportServerChallenge to set.
- */
- public void setMustSupportServerChallenge(boolean mustSupportServerChallenge) {
+ protected void setMustSupportServerChallenge(boolean mustSupportServerChallenge) {
this.mustSupportServerChallenge = mustSupportServerChallenge;
}
- /**
- * @return Returns the requireClientEntropy.
- */
public boolean isRequireClientEntropy() {
return requireClientEntropy;
}
- /**
- * @param requireClientEntropy The requireClientEntropy to set.
- */
- public void setRequireClientEntropy(boolean requireClientEntropy) {
+ protected void setRequireClientEntropy(boolean requireClientEntropy) {
this.requireClientEntropy = requireClientEntropy;
}
- /**
- * @return Returns the requireServerEntropy.
- */
public boolean isRequireServerEntropy() {
return requireServerEntropy;
}
- /**
- * @param requireServerEntropy The requireServerEntropy to set.
- */
- public void setRequireServerEntropy(boolean requireServerEntropy) {
+ protected void setRequireServerEntropy(boolean requireServerEntropy) {
this.requireServerEntropy = requireServerEntropy;
}
- /* (non-Javadoc)
- * @see org.apache.neethi.Assertion#getName()
- */
- public QName getName() {
- return SP11Constants.TRUST_10;
- }
-
- /* (non-Javadoc)
- * @see org.apache.neethi.Assertion#isOptional()
- */
- public boolean isOptional() {
- // TODO TODO Sanka
- throw new UnsupportedOperationException("TODO Sanka");
- }
-
- public PolicyComponent normalize() {
- return this;
- }
-
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-
- String localname = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
-
- // <sp:Trust10>
- writer.writeStartElement(prefix, localname, namespaceURI);
- // xmlns:sp=".."
- writer.writeNamespace(prefix, namespaceURI);
-
- String wspPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
- if (wspPrefix == null) {
- wspPrefix = SPConstants.POLICY.getPrefix();
- writer.setPrefix(wspPrefix, SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
- if (isMustSupportClientChallenge()) {
- // <sp:MustSupportClientChallenge />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_CLIENT_CHALLENGE, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportServerChallenge()) {
- // <sp:MustSupportServerChallenge />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_SERVER_CHALLENGE, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isRequireClientEntropy()) {
- // <sp:RequireClientEntropy />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_CLIENT_ENTROPY, namespaceURI);
- writer.writeEndElement();
- }
-
-
- if (isRequireServerEntropy()) {
- // <sp:RequireServerEntropy />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_SERVER_ENTROPY, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportIssuedTokens()) {
- // <sp:MustSupportIssuedTokens />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_ISSUED_TOKENS, namespaceURI);
- writer.writeEndElement();
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
-
- // </sp:Trust10>
- writer.writeEndElement();
-
-
-
-
+ public boolean isMustSupportIssuedTokens() {
+ return mustSupportIssuedTokens;
}
- public short getType() {
- return org.apache.neethi.Constants.TYPE_ASSERTION;
+ protected void setMustSupportIssuedTokens(boolean mustSupportIssuedTokens) {
+ this.mustSupportIssuedTokens = mustSupportIssuedTokens;
}
-
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust10.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust13.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust13.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust13.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust13.java Sun Dec 4 20:33:05 2011
@@ -1,247 +1,133 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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
+/**
+ * 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
+ * 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.
+ * 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.apache.ws.secpolicy.model;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.SP12Constants;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
/**
- * Model bean to capture Trust10 assertion info
+ * @author $Author$
+ * @version $Revision$ $Date$
*/
-public class Trust13 extends AbstractSecurityAssertion {
+public class Trust13 extends Trust10 {
- private boolean mustSupportClientChallenge;
- private boolean mustSupportServerChallenge;
- private boolean requireClientEntropy;
- private boolean requireServerEntropy;
- private boolean mustSupportIssuedTokens;
private boolean requireRequestSecurityTokenCollection;
private boolean requireAppliesTo;
-
- public Trust13(int version){
- setVersion(version);
- }
-
- /**
- * @return Returns the mustSupportClientChallenge.
- */
- public boolean isMustSupportClientChallenge() {
- return mustSupportClientChallenge;
- }
+ private boolean scopePolicy15;
+ private boolean mustSupportInteractiveChallenge;
- /**
- * @param mustSupportClientChallenge The mustSupportClientChallenge to set.
- */
- public void setMustSupportClientChallenge(boolean mustSupportClientChallenge) {
- this.mustSupportClientChallenge = mustSupportClientChallenge;
- }
-
- /**
- * @return Returns the mustSupportIssuedTokens.
- */
- public boolean isMustSupportIssuedTokens() {
- return mustSupportIssuedTokens;
- }
-
- /**
- * @param mustSupportIssuedTokens The mustSupportIssuedTokens to set.
- */
- public void setMustSupportIssuedTokens(boolean mustSupportIssuedTokens) {
- this.mustSupportIssuedTokens = mustSupportIssuedTokens;
- }
-
- /**
- * @return Returns the mustSupportServerChallenge.
- */
- public boolean isMustSupportServerChallenge() {
- return mustSupportServerChallenge;
- }
+ public Trust13(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version, nestedPolicy);
- /**
- * @param mustSupportServerChallenge The mustSupportServerChallenge to set.
- */
- public void setMustSupportServerChallenge(boolean mustSupportServerChallenge) {
- this.mustSupportServerChallenge = mustSupportServerChallenge;
+ parseNestedTrust13Policy(nestedPolicy, this);
}
- /**
- * @return Returns the requireClientEntropy.
- */
- public boolean isRequireClientEntropy() {
- return requireClientEntropy;
- }
-
- /**
- * @param requireClientEntropy The requireClientEntropy to set.
- */
- public void setRequireClientEntropy(boolean requireClientEntropy) {
- this.requireClientEntropy = requireClientEntropy;
+ public QName getName() {
+ return getVersion().getSPConstants().getTrust13();
}
- /**
- * @return Returns the requireServerEntropy.
- */
- public boolean isRequireServerEntropy() {
- return requireServerEntropy;
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(org.apache.neethi.Policy nestedPolicy) {
+ return new Trust13(getVersion(), nestedPolicy);
+ }
+
+ protected void parseNestedTrust13Policy(Policy nestedPolicy, Trust13 trust13) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ if (getVersion().getSPConstants().getRequireRequestSecurityTokenCollection().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getRequireRequestSecurityTokenCollection().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust13.isRequireRequestSecurityTokenCollection()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust13.setRequireRequestSecurityTokenCollection(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getRequireAppliesTo().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getRequireAppliesTo().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust13.isRequireAppliesTo()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust13.setRequireAppliesTo(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getScopePolicy15().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getScopePolicy15().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust13.isScopePolicy15()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust13.setScopePolicy15(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportInteractiveChallenge().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportInteractiveChallenge().getNamespaceURI().equals(assertionNamespace)) {
+ if (trust13.isMustSupportInteractiveChallenge()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ trust13.setMustSupportInteractiveChallenge(true);
+ continue;
+ }
+ }
+ }
}
- /**
- * @param requireServerEntropy The requireServerEntropy to set.
- */
- public void setRequireServerEntropy(boolean requireServerEntropy) {
- this.requireServerEntropy = requireServerEntropy;
- }
-
- /**
- * @return Returns the requireRequestSecurityTokenCollection.
- */
public boolean isRequireRequestSecurityTokenCollection() {
return requireRequestSecurityTokenCollection;
}
- /**
- * @param requireRequestSecurityTokenCollection The requireRequestSecurityTokenCollection to set.
- */
- public void setRequireRequestSecurityTokenCollection(boolean requireRequestSecurityTokenCollection) {
+ protected void setRequireRequestSecurityTokenCollection(boolean requireRequestSecurityTokenCollection) {
this.requireRequestSecurityTokenCollection = requireRequestSecurityTokenCollection;
}
-
- /**
- * @return Returns the requireAppliesTo.
- */
+
public boolean isRequireAppliesTo() {
return requireAppliesTo;
}
- /**
- * @param requireAppliesTo The requireAppliesTo to set.
- */
- public void setRequireAppliesTo(boolean requireAppliesTo) {
+ protected void setRequireAppliesTo(boolean requireAppliesTo) {
this.requireAppliesTo = requireAppliesTo;
}
- /* (non-Javadoc)
- * @see org.apache.neethi.Assertion#getName()
- */
- public QName getName() {
- return SP12Constants.TRUST_13;
+ public boolean isScopePolicy15() {
+ return scopePolicy15;
}
- /* (non-Javadoc)
- * @see org.apache.neethi.Assertion#isOptional()
- */
- public boolean isOptional() {
- // TODO TODO Sanka
- throw new UnsupportedOperationException("TODO Sanka");
- }
-
- public PolicyComponent normalize() {
- return this;
- }
-
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-
- String localname = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
-
- // <sp:Trust13>
- writer.writeStartElement(prefix, localname, namespaceURI);
- // xmlns:sp=".."
- writer.writeNamespace(prefix, namespaceURI);
-
- String wspPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
-
- if (wspPrefix == null) {
- wspPrefix = SPConstants.POLICY.getPrefix();
- writer.setPrefix(wspPrefix, SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
- if (isMustSupportClientChallenge()) {
- // <sp:MustSupportClientChallenge />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_CLIENT_CHALLENGE, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportServerChallenge()) {
- // <sp:MustSupportServerChallenge />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_SERVER_CHALLENGE, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isRequireClientEntropy()) {
- // <sp:RequireClientEntropy />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_CLIENT_ENTROPY, namespaceURI);
- writer.writeEndElement();
- }
-
-
- if (isRequireServerEntropy()) {
- // <sp:RequireServerEntropy />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_SERVER_ENTROPY, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportIssuedTokens()) {
- // <sp:MustSupportIssuedTokens />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_ISSUED_TOKENS, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isRequireRequestSecurityTokenCollection()) {
- // <sp:RequireRequestSecurityTokenCollection />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isRequireAppliesTo()) {
- // <sp:RequireAppliesTo />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_APPLIES_TO, namespaceURI);
- writer.writeEndElement();
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
-
- // </sp:Trust13>
- writer.writeEndElement();
-
-
-
-
+ protected void setScopePolicy15(boolean scopePolicy15) {
+ this.scopePolicy15 = scopePolicy15;
}
- public short getType() {
- return org.apache.neethi.Constants.TYPE_ASSERTION;
+ public boolean isMustSupportInteractiveChallenge() {
+ return mustSupportInteractiveChallenge;
}
+ protected void setMustSupportInteractiveChallenge(boolean mustSupportInteractiveChallenge) {
+ this.mustSupportInteractiveChallenge = mustSupportInteractiveChallenge;
+ }
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Trust13.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/UsernameToken.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/UsernameToken.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/UsernameToken.java Sun Dec 4 20:33:05 2011
@@ -1,174 +1,174 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.apache.ws.secpolicy.model;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+import org.apache.ws.secpolicy.SPConstants;
+import org.w3c.dom.Element;
+
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
+import java.util.*;
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.SP12Constants;
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class UsernameToken extends AbstractToken {
-public class UsernameToken extends Token {
+ public enum PasswordType {
+ NoPassword,
+ HashPassword;
- private boolean useUTProfile10 = false;
+ private static final Map<String, PasswordType> lookup = new HashMap<String, PasswordType>();
- private boolean useUTProfile11 = false;
-
- private boolean noPassword;
-
- private boolean hashPassword;
-
- public UsernameToken(int version){
- setVersion(version);
- }
+ static {
+ for (PasswordType u : EnumSet.allOf(PasswordType.class))
+ lookup.put(u.name(), u);
+ }
- /**
- * @return Returns the useUTProfile11.
- */
- public boolean isUseUTProfile11() {
- return useUTProfile11;
+ public static PasswordType lookUp(String name) {
+ return lookup.get(name);
+ }
}
- /**
- * @param useUTProfile11
- * The useUTProfile11 to set.
- */
- public void setUseUTProfile11(boolean useUTProfile11) {
- this.useUTProfile11 = useUTProfile11;
- }
-
- public boolean isNoPassword() {
- return noPassword;
- }
-
- public void setNoPassword(boolean noPassword) {
- this.noPassword = noPassword;
- }
-
- public boolean isHashPassword() {
- return hashPassword;
- }
-
- public void setHashPassword(boolean hashPassword) {
- this.hashPassword = hashPassword;
- }
+ public enum UsernameTokenType {
+ WssUsernameToken10,
+ WssUsernameToken11;
+
+ private static final Map<String, UsernameTokenType> lookup = new HashMap<String, UsernameTokenType>();
+
+ static {
+ for (UsernameTokenType u : EnumSet.allOf(UsernameTokenType.class))
+ lookup.put(u.name(), u);
+ }
- public boolean isUseUTProfile10() {
- return useUTProfile10;
+ public static UsernameTokenType lookUp(String name) {
+ return lookup.get(name);
+ }
}
- public void setUseUTProfile10(boolean useUTProfile10) {
- this.useUTProfile10 = useUTProfile10;
- }
+ private PasswordType passwordType;
+ private boolean created;
+ private boolean nonce;
+ private UsernameTokenType usernameTokenType;
+
+ public UsernameToken(SPConstants.SPVersion version, SPConstants.IncludeTokenType includeTokenType,
+ Element issuer, String issuerName, Element claims, Policy nestedPolicy) {
+ super(version, includeTokenType, issuer, issuerName, claims, nestedPolicy);
- public QName getName() {
- if (version == SPConstants.SP_V12) {
- return SP12Constants.USERNAME_TOKEN;
- } else {
- return SP11Constants.USERNAME_TOKEN;
- }
+ parseNestedPolicy(nestedPolicy, this);
}
- public PolicyComponent normalize() {
- throw new UnsupportedOperationException();
+ public QName getName() {
+ return getVersion().getSPConstants().getUsernameToken();
}
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- String localname = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new UsernameToken(getVersion(), getIncludeTokenType(), getIssuer(), getIssuerName(), getClaims(), nestedPolicy);
+ }
+
+ protected void parseNestedPolicy(Policy nestedPolicy, UsernameToken usernameToken) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ PasswordType passwordType = PasswordType.lookUp(assertionName);
+ if (passwordType != null) {
+ if (usernameToken.getPasswordType() != null) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ usernameToken.setPasswordType(passwordType);
+ continue;
+ }
+ if (getVersion().getSPConstants().getCreated().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getCreated().getNamespaceURI().equals(assertionNamespace)) {
+ if (usernameToken.isCreated()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ usernameToken.setCreated(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getNonce().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getNonce().getNamespaceURI().equals(assertionNamespace)) {
+ if (usernameToken.isNonce()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ usernameToken.setNonce(true);
+ continue;
+ }
+ DerivedKeys derivedKeys = DerivedKeys.lookUp(assertionName);
+ if (derivedKeys != null) {
+ if (usernameToken.getDerivedKeys() != null) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ usernameToken.setDerivedKeys(derivedKeys);
+ continue;
+ }
+ UsernameTokenType usernameTokenType = UsernameTokenType.lookUp(assertionName);
+ if (usernameTokenType != null) {
+ if (usernameToken.getUsernameTokenType() != null) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ usernameToken.setUsernameTokenType(usernameTokenType);
+ continue;
+ }
+ }
}
+ }
- // <sp:UsernameToken
- writer.writeStartElement(prefix, localname, namespaceURI);
-
- writer.writeNamespace(prefix, namespaceURI);
-
- String inclusion;
-
- if (version == SPConstants.SP_V12) {
- inclusion = SP12Constants.getAttributeValueFromInclusion(getInclusion());
- } else {
- inclusion = SP11Constants.getAttributeValueFromInclusion(getInclusion());
- }
+ public PasswordType getPasswordType() {
+ return passwordType;
+ }
- if (inclusion != null) {
- writer.writeAttribute(prefix, namespaceURI, SPConstants.ATTR_INCLUDE_TOKEN, inclusion);
- }
+ protected void setPasswordType(PasswordType passwordType) {
+ this.passwordType = passwordType;
+ }
- if (isUseUTProfile10() || isUseUTProfile11()) {
- String pPrefix = writer.getPrefix(SPConstants.POLICY
- .getNamespaceURI());
- if (pPrefix == null) {
- writer.setPrefix(SPConstants.POLICY.getPrefix(), SPConstants.POLICY
- .getNamespaceURI());
- }
+ public boolean isCreated() {
+ return created;
+ }
- // <wsp:Policy>
- writer.writeStartElement(prefix, SPConstants.POLICY.getLocalPart(),
- SPConstants.POLICY.getNamespaceURI());
-
- // CHECKME
- if (isUseUTProfile10()) {
- // <sp:WssUsernameToken10 />
- writer.writeStartElement(prefix, SPConstants.USERNAME_TOKEN10 , namespaceURI);
- } else {
- // <sp:WssUsernameToken11 />
- writer.writeStartElement(prefix, SPConstants.USERNAME_TOKEN11 , namespaceURI);
- }
-
- if (version == SPConstants.SP_V12) {
-
- if (isNoPassword()) {
- writer.writeStartElement(prefix, SPConstants.NO_PASSWORD, namespaceURI);
- writer.writeEndElement();
- } else if (isHashPassword()){
- writer.writeStartElement(prefix, SPConstants.HASH_PASSWORD, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isDerivedKeys()) {
- writer.writeStartElement(prefix, SPConstants.REQUIRE_DERIVED_KEYS, namespaceURI);
- writer.writeEndElement();
- } else if (isExplicitDerivedKeys()) {
- writer.writeStartElement(prefix, SPConstants.REQUIRE_EXPLICIT_DERIVED_KEYS, namespaceURI);
- writer.writeEndElement();
- } else if (isImpliedDerivedKeys()) {
- writer.writeStartElement(prefix, SPConstants.REQUIRE_IMPLIED_DERIVED_KEYS, namespaceURI);
- writer.writeEndElement();
- }
-
- }
- writer.writeEndElement();
+ protected void setCreated(boolean created) {
+ this.created = created;
+ }
- // </wsp:Policy>
- writer.writeEndElement();
+ public boolean isNonce() {
+ return nonce;
+ }
- }
+ protected void setNonce(boolean nonce) {
+ this.nonce = nonce;
+ }
- writer.writeEndElement();
- // </sp:UsernameToken>
+ public UsernameTokenType getUsernameTokenType() {
+ return usernameTokenType;
+ }
+ protected void setUsernameTokenType(UsernameTokenType usernameTokenType) {
+ this.usernameTokenType = usernameTokenType;
}
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/UsernameToken.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss10.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss10.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss10.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss10.java Sun Dec 4 20:33:05 2011
@@ -1,157 +1,151 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.apache.ws.secpolicy.model;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
+import org.apache.ws.secpolicy.SPConstants;
+
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import java.util.Iterator;
+import java.util.List;
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class Wss10 extends AbstractSecurityAssertion implements PolicyContainingAssertion {
-public class Wss10 extends AbstractSecurityAssertion {
-
+ private Policy nestedPolicy;
private boolean mustSupportRefKeyIdentifier;
- private boolean MustSupportRefIssuerSerial;
- private boolean MustSupportRefExternalURI;
- private boolean MustSupportRefEmbeddedToken;
-
- public Wss10(int version) {
- setVersion(version);
- }
-
- /**
- * @return Returns the mustSupportRefEmbeddedToken.
- */
- public boolean isMustSupportRefEmbeddedToken() {
- return MustSupportRefEmbeddedToken;
+ private boolean mustSupportRefIssuerSerial;
+ private boolean mustSupportRefExternalURI;
+ private boolean mustSupportRefEmbeddedToken;
+
+ public Wss10(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version);
+ this.nestedPolicy = nestedPolicy;
+
+ parseNestedWss10Policy(nestedPolicy, this);
}
- /**
- * @param mustSupportRefEmbeddedToken The mustSupportRefEmbeddedToken to set.
- */
- public void setMustSupportRefEmbeddedToken(boolean mustSupportRefEmbeddedToken) {
- MustSupportRefEmbeddedToken = mustSupportRefEmbeddedToken;
- }
- /**
- * @return Returns the mustSupportRefExternalURI.
- */
- public boolean isMustSupportRefExternalURI() {
- return MustSupportRefExternalURI;
+
+ public Policy getPolicy() {
+ return this.nestedPolicy;
}
- /**
- * @param mustSupportRefExternalURI The mustSupportRefExternalURI to set.
- */
- public void setMustSupportRefExternalURI(boolean mustSupportRefExternalURI) {
- MustSupportRefExternalURI = mustSupportRefExternalURI;
- }
- /**
- * @return Returns the mustSupportRefIssuerSerial.
- */
- public boolean isMustSupportRefIssuerSerial() {
- return MustSupportRefIssuerSerial;
+
+ public QName getName() {
+ return getVersion().getSPConstants().getWss10();
+ }
+
+ public PolicyComponent normalize() {
+ return super.normalize(getPolicy());
+ }
+
+ public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+ super.serialize(writer, getPolicy());
}
- /**
- * @param mustSupportRefIssuerSerial The mustSupportRefIssuerSerial to set.
- */
- public void setMustSupportRefIssuerSerial(boolean mustSupportRefIssuerSerial) {
- MustSupportRefIssuerSerial = mustSupportRefIssuerSerial;
- }
- /**
- * @return Returns the mustSupportRefKeyIdentifier.
- */
+
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new Wss10(getVersion(), nestedPolicy);
+ }
+
+ protected void parseNestedWss10Policy(Policy nestedPolicy, Wss10 wss10) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ if (getVersion().getSPConstants().getMustSupportRefKeyIdentifier().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefKeyIdentifier().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss10.isMustSupportRefKeyIdentifier()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss10.setMustSupportRefKeyIdentifier(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportRefIssuerSerial().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefIssuerSerial().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss10.isMustSupportRefIssuerSerial()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss10.setMustSupportRefIssuerSerial(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportRefExternalUri().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefExternalUri().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss10.isMustSupportRefExternalURI()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss10.setMustSupportRefExternalURI(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportRefEmbeddedToken().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefEmbeddedToken().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss10.isMustSupportRefEmbeddedToken()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss10.setMustSupportRefEmbeddedToken(true);
+ continue;
+ }
+ }
+ }
+ }
+
public boolean isMustSupportRefKeyIdentifier() {
return mustSupportRefKeyIdentifier;
}
- /**
- * @param mustSupportRefKeyIdentifier The mustSupportRefKeyIdentifier to set.
- */
- public void setMustSupportRefKeyIdentifier(boolean mustSupportRefKeyIdentifier) {
+
+ protected void setMustSupportRefKeyIdentifier(boolean mustSupportRefKeyIdentifier) {
this.mustSupportRefKeyIdentifier = mustSupportRefKeyIdentifier;
}
-
- public QName getName() {
- if ( version == SPConstants.SP_V12 ) {
- return SP12Constants.WSS10;
- } else {
- return SP11Constants.WSS10;
- }
+
+ public boolean isMustSupportRefIssuerSerial() {
+ return mustSupportRefIssuerSerial;
}
-
- public PolicyComponent normalize() {
- return this;
+
+ protected void setMustSupportRefIssuerSerial(boolean mustSupportRefIssuerSerial) {
+ this.mustSupportRefIssuerSerial = mustSupportRefIssuerSerial;
}
-
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- String localname = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
- String prefix = writer.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
+ public boolean isMustSupportRefExternalURI() {
+ return mustSupportRefExternalURI;
+ }
- // <sp:Wss10>
- writer.writeStartElement(prefix, localname, namespaceURI);
-
- // xmlns:sp=".."
- writer.writeNamespace(prefix, namespaceURI);
-
- String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
- if (pPrefix == null) {
- writer.setPrefix(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(prefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
- if (isMustSupportRefKeyIdentifier()) {
- // <sp:MustSupportRefKeyIdentifier />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefIssuerSerial()) {
- // <sp:MustSupportRefIssuerSerial />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefExternalURI()) {
- // <sp:MustSupportRefExternalURI />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI, namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefEmbeddedToken()) {
- // <sp:MustSupportRefEmbeddedToken />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN, namespaceURI);
- writer.writeEndElement();
+ protected void setMustSupportRefExternalURI(boolean mustSupportRefExternalURI) {
+ this.mustSupportRefExternalURI = mustSupportRefExternalURI;
+ }
-
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
- // </sp:Wss10>
- writer.writeEndElement();
+ public boolean isMustSupportRefEmbeddedToken() {
+ return mustSupportRefEmbeddedToken;
+ }
+ protected void setMustSupportRefEmbeddedToken(boolean mustSupportRefEmbeddedToken) {
+ this.mustSupportRefEmbeddedToken = mustSupportRefEmbeddedToken;
}
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss10.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss11.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss11.java?rev=1210203&r1=1210202&r2=1210203&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss11.java (original)
+++ webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss11.java Sun Dec 4 20:33:05 2011
@@ -1,154 +1,116 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.apache.ws.secpolicy.model;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
import org.apache.ws.secpolicy.SPConstants;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
public class Wss11 extends Wss10 {
-
- private boolean MustSupportRefThumbprint;
- private boolean MustSupportRefEncryptedKey;
- private boolean RequireSignatureConfirmation;
-
- public Wss11(int version) {
- super(version);
- }
-
- /**
- * @return Returns the mustSupportRefEncryptedKey.
- */
- public boolean isMustSupportRefEncryptedKey() {
- return MustSupportRefEncryptedKey;
+
+ private boolean mustSupportRefThumbprint;
+ private boolean mustSupportRefEncryptedKey;
+ private boolean requireSignatureConfirmation;
+
+ public Wss11(SPConstants.SPVersion version, Policy nestedPolicy) {
+ super(version, nestedPolicy);
+
+ parseNestedWss11Policy(nestedPolicy, this);
}
- /**
- * @param mustSupportRefEncryptedKey The mustSupportRefEncryptedKey to set.
- */
- public void setMustSupportRefEncryptedKey(boolean mustSupportRefEncryptedKey) {
- MustSupportRefEncryptedKey = mustSupportRefEncryptedKey;
- }
- /**
- * @return Returns the mustSupportRefThumbprint.
- */
+
+ public QName getName() {
+ return getVersion().getSPConstants().getWss11();
+ }
+
+ @Override
+ protected AbstractSecurityAssertion cloneAssertion(Policy nestedPolicy) {
+ return new Wss11(getVersion(), nestedPolicy);
+ }
+
+ protected void parseNestedWss11Policy(Policy nestedPolicy, Wss11 wss11) {
+ Iterator<List<Assertion>> alternatives = nestedPolicy.getAlternatives();
+ //we just process the first alternative
+ //this means that if we have a compact policy only the first alternative is visible
+ //in contrary to a normalized policy where just one alternative exists
+ if (alternatives.hasNext()) {
+ List<Assertion> assertions = alternatives.next();
+ for (int i = 0; i < assertions.size(); i++) {
+ Assertion assertion = assertions.get(i);
+ String assertionName = assertion.getName().getLocalPart();
+ String assertionNamespace = assertion.getName().getNamespaceURI();
+ if (getVersion().getSPConstants().getMustSupportRefThumbprint().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefThumbprint().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss11.isMustSupportRefThumbprint()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss11.setMustSupportRefThumbprint(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getMustSupportRefEncryptedKey().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getMustSupportRefEncryptedKey().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss11.isMustSupportRefEncryptedKey()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss11.setMustSupportRefEncryptedKey(true);
+ continue;
+ }
+ if (getVersion().getSPConstants().getRequireSignatureConfirmation().getLocalPart().equals(assertionName)
+ && getVersion().getSPConstants().getRequireSignatureConfirmation().getNamespaceURI().equals(assertionNamespace)) {
+ if (wss11.isRequireSignatureConfirmation()) {
+ throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
+ }
+ wss11.setRequireSignatureConfirmation(true);
+ continue;
+ }
+ }
+ }
+ }
+
public boolean isMustSupportRefThumbprint() {
- return MustSupportRefThumbprint;
+ return mustSupportRefThumbprint;
}
- /**
- * @param mustSupportRefThumbprint The mustSupportRefThumbprint to set.
- */
- public void setMustSupportRefThumbprint(boolean mustSupportRefThumbprint) {
- MustSupportRefThumbprint = mustSupportRefThumbprint;
- }
- /**
- * @return Returns the requireSignatureConfirmation.
- */
- public boolean isRequireSignatureConfirmation() {
- return RequireSignatureConfirmation;
+
+ protected void setMustSupportRefThumbprint(boolean mustSupportRefThumbprint) {
+ this.mustSupportRefThumbprint = mustSupportRefThumbprint;
}
- /**
- * @param requireSignatureConfirmation The requireSignatureConfirmation to set.
- */
- public void setRequireSignatureConfirmation(boolean requireSignatureConfirmation) {
- RequireSignatureConfirmation = requireSignatureConfirmation;
+
+ public boolean isMustSupportRefEncryptedKey() {
+ return mustSupportRefEncryptedKey;
}
-
- public QName getName() {
- if ( version == SPConstants.SP_V12 ) {
- return SP12Constants.WSS11;
- } else {
- return SP11Constants.WSS11;
- }
- }
-
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- String localname = getName().getLocalPart();
- String namespaceURI = getName().getNamespaceURI();
-
- String prefix = writer.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = getName().getPrefix();
- writer.setPrefix(prefix, namespaceURI);
- }
- // <sp:Wss11>
- writer.writeStartElement(prefix, localname, namespaceURI);
-
- // xmlns:sp=".."
- writer.writeNamespace(prefix, namespaceURI);
-
- String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
- if (pPrefix == null) {
- writer.setPrefix(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getNamespaceURI());
- }
-
- // <wsp:Policy>
- writer.writeStartElement(prefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
-
- // <sp:MustSupportRefKeyIndentifier />
- if (isMustSupportRefKeyIdentifier()) {
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefIssuerSerial()) {
- // <sp:MustSupportRefIssuerSerial />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefExternalURI()) {
- // <sp:MustSupportRefExternalURI />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefEmbeddedToken()) {
- // <sp:MustSupportRefEmbeddedToken />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_EMBEDDED_TOKEN , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefThumbprint()) {
- // <sp:MustSupportRefThumbprint />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_THUMBPRINT , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isMustSupportRefEncryptedKey()) {
- // <sp:MustSupportRefEncryptedKey />
- writer.writeStartElement(prefix, SPConstants.MUST_SUPPORT_REF_ENCRYPTED_KEY , namespaceURI);
- writer.writeEndElement();
- }
-
- if (isRequireSignatureConfirmation()) {
- // <sp:RequireSignatureConfirmation />
- writer.writeStartElement(prefix, SPConstants.REQUIRE_SIGNATURE_CONFIRMATION , namespaceURI);
- writer.writeEndElement();
- }
-
- // </wsp:Policy>
- writer.writeEndElement();
-
- // </sp:Wss11>
- writer.writeEndElement();
+ protected void setMustSupportRefEncryptedKey(boolean mustSupportRefEncryptedKey) {
+ this.mustSupportRefEncryptedKey = mustSupportRefEncryptedKey;
+ }
+
+ public boolean isRequireSignatureConfirmation() {
+ return requireSignatureConfirmation;
+ }
+
+ protected void setRequireSignatureConfirmation(boolean requireSignatureConfirmation) {
+ this.requireSignatureConfirmation = requireSignatureConfirmation;
}
}
Propchange: webservices/wss4j/branches/swssf/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Wss11.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision