Skip to content
Permalink
Browse files
Picking up WSS4J 2.0.0-SNAPSHOT again
  • Loading branch information
coheigea committed Feb 19, 2014
1 parent 5723211 commit ed8ac50116f225ad4a71b888b7e4f44c1f81991a
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 33 deletions.
@@ -148,7 +148,7 @@
<cxf.woodstox.core.version>4.2.0</cxf.woodstox.core.version>
<cxf.woodstox.stax2-api.version>3.1.1</cxf.woodstox.stax2-api.version>
<cxf.wsdl4j.version>1.6.3</cxf.wsdl4j.version>
<cxf.wss4j.version>2.0.0-rc1</cxf.wss4j.version>
<cxf.wss4j.version>2.0.0-SNAPSHOT</cxf.wss4j.version>
<cxf.xerces.version>2.11.0</cxf.xerces.version>
<cxf.xmlbeans.version>2.6.0</cxf.xmlbeans.version>
<cxf.xmlschema.version>2.1.0</cxf.xmlschema.version>
@@ -56,7 +56,7 @@
import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import org.apache.wss4j.common.derivedKey.ConversationConstants;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.dom.WSSecurityEngineResult;
import org.apache.wss4j.dom.handler.WSHandlerConstants;
@@ -157,7 +157,7 @@ static AlgorithmSuite getAlgorithmSuite(AssertionInfoMap aim) {
return null;
}

static int getWSCVersion(String tokenTypeValue) throws ConversationException {
static int getWSCVersion(String tokenTypeValue) throws WSSecurityException {
if (tokenTypeValue == null) {
return ConversationConstants.DEFAULT_VERSION;
}
@@ -167,7 +167,8 @@ static int getWSCVersion(String tokenTypeValue) throws ConversationException {
} else if (tokenTypeValue.startsWith(ConversationConstants.WSC_NS_05_12)) {
return ConversationConstants.getWSTVersion(ConversationConstants.WSC_NS_05_12);
} else {
throw new ConversationException("unsupportedSecConvVersion");
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
"unsupportedSecConvVersion");
}
}

@@ -44,7 +44,6 @@
import org.apache.cxf.ws.security.tokenstore.SecurityToken;
import org.apache.cxf.ws.security.tokenstore.TokenStore;
import org.apache.cxf.ws.security.trust.STSUtils;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.derivedKey.P_SHA1;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
@@ -193,7 +192,7 @@ byte[] writeProofToken(String prefix,
W3CDOMStreamWriter writer,
byte[] clientEntropy,
int keySize
) throws NoSuchAlgorithmException, WSSecurityException, ConversationException, XMLStreamException {
) throws NoSuchAlgorithmException, WSSecurityException, XMLStreamException {
byte secret[] = null;
writer.writeStartElement(prefix, "RequestedProofToken", namespace);
if (clientEntropy == null) {
@@ -108,7 +108,6 @@
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoFactory;
import org.apache.wss4j.common.crypto.CryptoType;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.derivedKey.P_SHA1;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
@@ -1378,7 +1377,7 @@ protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy)
}
try {
secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length / 8);
} catch (ConversationException e) {
} catch (WSSecurityException e) {
throw new TrustException("DERIVED_KEY_ERROR", LOG, e);
}
} else {
@@ -498,7 +498,6 @@ private PolicyEnforcer createPolicyEnforcer(
EffectivePolicy policy =
(EffectivePolicy)bindingOperationInfo.getProperty("policy-engine-info-serve-request");
//PolicyEngineImpl.POLICY_INFO_REQUEST_SERVER);
String localName = operationName.getLocalPart();
if (MessageUtils.isRequestor(msg)) {
policy =
(EffectivePolicy)bindingOperationInfo.getProperty("policy-engine-info-client-response");
@@ -509,13 +508,23 @@ private PolicyEnforcer createPolicyEnforcer(
}
if (bindingOperationInfo.getOutput() != null) {
MessageInfo messageInfo = bindingOperationInfo.getOutput().getMessageInfo();
localName = messageInfo.getName().getLocalPart();
operationName = messageInfo.getName();
if (!messageInfo.getMessageParts().isEmpty()
&& messageInfo.getMessagePart(0).getConcreteName() != null) {
localName = messageInfo.getMessagePart(0).getConcreteName().getLocalPart();
operationName = messageInfo.getMessagePart(0).getConcreteName();
}
}
} else {
if (bindingOperationInfo.getInput() != null) {
MessageInfo messageInfo = bindingOperationInfo.getInput().getMessageInfo();
operationName = messageInfo.getName();
if (!messageInfo.getMessageParts().isEmpty()
&& messageInfo.getMessagePart(0).getConcreteName() != null) {
operationName = messageInfo.getMessagePart(0).getConcreteName();
}
}
}

SoapOperationInfo soapOperationInfo = bindingOperationInfo.getExtensor(SoapOperationInfo.class);
if (soapOperationInfo != null && policy == null && dispatchPolicy != null) {
policy = dispatchPolicy;
@@ -532,9 +541,7 @@ private PolicyEnforcer createPolicyEnforcer(
throw new IllegalArgumentException("BindingInfo is not an instance of SoapBindingInfo");
}

//todo: I think its a bug that we handover only the localPart of the operation.
// Needs to be fixed in ws-security-policy-stax
OperationPolicy operationPolicy = new OperationPolicy(localName);
OperationPolicy operationPolicy = new OperationPolicy(operationName);
operationPolicy.setPolicy(policy.getPolicy());
operationPolicy.setOperationAction(soapOperationInfo.getAction());
operationPolicy.setSoapMessageVersionNamespace(soapNS);
@@ -83,7 +83,6 @@
import org.apache.wss4j.common.crypto.JasyptPasswordEncryptor;
import org.apache.wss4j.common.crypto.PasswordEncryptor;
import org.apache.wss4j.common.derivedKey.ConversationConstants;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.ext.WSPasswordCallback;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.principal.UsernameTokenPrincipal;
@@ -1851,7 +1850,7 @@ protected void doEndorsedSignatures(List<SupportingToken> tokenList,

private void doSymmSignatureDerived(AbstractToken policyToken, SecurityToken tok,
List<WSEncryptionPart> sigParts, boolean isTokenProtection)
throws WSSecurityException, ConversationException {
throws WSSecurityException {

Document doc = saaj.getSOAPPart();
WSSecDKSign dkSign = new WSSecDKSign(wssConfig);
@@ -1933,7 +1932,7 @@ private void doSymmSignatureDerived(AbstractToken policyToken, SecurityToken tok

private void doSymmSignature(AbstractToken policyToken, SecurityToken tok,
List<WSEncryptionPart> sigParts, boolean isTokenProtection)
throws WSSecurityException, ConversationException {
throws WSSecurityException {

Document doc = saaj.getSOAPPart();
WSSecSignature sig = new WSSecSignature(wssConfig);
@@ -44,7 +44,6 @@
import org.apache.wss4j.common.WSEncryptionPart;
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.derivedKey.ConversationConstants;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.dom.WSSConfig;
@@ -700,12 +699,7 @@ private byte[] doSignatureDK(List<WSEncryptionPart> sigs,
}
}

try {
dkSign.prepare(doc, secHeader);
} catch (ConversationException e) {
LOG.log(Level.FINE, e.getMessage(), e);
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
}
dkSign.prepare(doc, secHeader);

if (sbinding.isProtectTokens()) {
String sigTokId = tok.getId();
@@ -25,7 +25,6 @@
import java.util.logging.Logger;

import org.w3c.dom.Document;

import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.sts.STSConstants;
@@ -34,9 +33,8 @@
import org.apache.cxf.ws.security.sts.provider.STSException;
import org.apache.cxf.ws.security.tokenstore.SecurityToken;
import org.apache.cxf.ws.security.trust.STSUtils;

import org.apache.wss4j.common.derivedKey.ConversationConstants;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.message.token.SecurityContextToken;

/**
@@ -196,7 +194,7 @@ public TokenProviderResponse createToken(TokenProviderParameters tokenParameters
/**
* Get the Secure Conversation version from the TokenType parameter
*/
private static int getWSCVersion(String tokenType) throws ConversationException {
private static int getWSCVersion(String tokenType) throws WSSecurityException {
if (tokenType == null) {
return ConversationConstants.DEFAULT_VERSION;
}
@@ -206,7 +204,8 @@ private static int getWSCVersion(String tokenType) throws ConversationException
} else if (tokenType.startsWith(ConversationConstants.WSC_NS_05_12)) {
return ConversationConstants.getWSTVersion(ConversationConstants.WSC_NS_05_12);
} else {
throw new ConversationException("unsupportedSecConvVersion");
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
"unsupportedSecConvVersion");
}
}

@@ -30,7 +30,6 @@
import org.apache.cxf.sts.request.Entropy;
import org.apache.cxf.sts.request.KeyRequirements;
import org.apache.cxf.ws.security.sts.provider.STSException;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.derivedKey.P_SHA1;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
@@ -180,7 +179,7 @@ public void createSymmetricKey() {
P_SHA1 psha1 = new P_SHA1();
secret = psha1.createKey(nonce, entropyBytes, 0, keySize / 8);
computedKey = true;
} catch (ConversationException ex) {
} catch (WSSecurityException ex) {
LOG.log(Level.WARNING, "", ex);
throw new STSException("Error in creating symmetric key", STSException.INVALID_REQUEST);
}
@@ -93,7 +93,6 @@
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoFactory;
import org.apache.wss4j.common.crypto.CryptoType;
import org.apache.wss4j.common.derivedKey.ConversationException;
import org.apache.wss4j.common.derivedKey.P_SHA1;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.dom.WSConstants;
@@ -930,7 +929,7 @@ protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy)
}
try {
secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length / 8);
} catch (ConversationException e) {
} catch (WSSecurityException e) {
throw new TrustException("DERIVED_KEY_ERROR", LOG, e);
}
} else {

0 comments on commit ed8ac50

Please sign in to comment.