You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/05/15 17:32:21 UTC
cxf git commit: Some updates following recent WSS4J changes
Repository: cxf
Updated Branches:
refs/heads/master ed397afd0 -> 3d747fa08
Some updates following recent WSS4J changes
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3d747fa0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3d747fa0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3d747fa0
Branch: refs/heads/master
Commit: 3d747fa0847db2798f6662a2540d4f3a79d83edd
Parents: ed397af
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri May 15 16:31:59 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri May 15 16:32:18 2015 +0100
----------------------------------------------------------------------
.../apache/cxf/rs/security/xml/EncryptionUtils.java | 16 ++++------------
.../cxf/rs/security/xml/XmlEncOutInterceptor.java | 15 +++------------
.../ws/security/trust/STSStaxTokenValidator.java | 4 ++--
.../cxf/ws/security/trust/STSTokenValidator.java | 4 ++--
4 files changed, 11 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/3d747fa0/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java
index 83951e0..daf81b5 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java
@@ -62,13 +62,9 @@ public final class EncryptionUtils {
} else {
cipher.init(mode, cert.getPublicKey(), oaepParameters);
}
- } catch (InvalidKeyException e) {
+ } catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e
- );
- } catch (InvalidAlgorithmParameterException e) {
- throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e
+ WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
);
}
return cipher;
@@ -92,13 +88,9 @@ public final class EncryptionUtils {
} else {
cipher.init(mode, key, oaepParameters);
}
- } catch (InvalidKeyException e) {
- throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e
- );
- } catch (InvalidAlgorithmParameterException e) {
+ } catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e
+ WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
);
}
return cipher;
http://git-wip-us.apache.org/repos/asf/cxf/blob/3d747fa0/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java
index 142a909..ad181ef 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java
@@ -206,17 +206,8 @@ public class XmlEncOutInterceptor extends AbstractXmlSecOutInterceptor {
byte[] encryptedEphemeralKey = null;
try {
encryptedEphemeralKey = cipher.doFinal(keyBytes);
- } catch (IllegalStateException ex) {
- throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex
- );
- } catch (IllegalBlockSizeException ex) {
- throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex
- );
- } catch (BadPaddingException ex) {
- throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex
+ } catch (IllegalStateException | IllegalBlockSizeException | BadPaddingException ex) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, ex
);
}
@@ -281,7 +272,7 @@ public class XmlEncOutInterceptor extends AbstractXmlSecOutInterceptor {
data = remoteCert.getEncoded();
} catch (CertificateEncodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "encodeError"
);
}
Text text = encryptedDataDoc.createTextNode(Base64.encode(data));
http://git-wip-us.apache.org/repos/asf/cxf/blob/3d747fa0/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSStaxTokenValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSStaxTokenValidator.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSStaxTokenValidator.java
index 0e1f8eb..31485e6 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSStaxTokenValidator.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSStaxTokenValidator.java
@@ -417,7 +417,7 @@ public class STSStaxTokenValidator
) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "badEncoding",
- binarySecurityTokenType.getEncodingType());
+ new Object[]{binarySecurityTokenType.getEncodingType()});
}
final byte[] securityTokenData = Base64.decodeBase64(binarySecurityTokenType.getValue());
@@ -522,7 +522,7 @@ public class STSStaxTokenValidator
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, "invalidValueType",
- binarySecurityTokenType.getValueType());
+ new Object[]{binarySecurityTokenType.getValueType()});
}
} catch (XMLSecurityException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, e);
http://git-wip-us.apache.org/repos/asf/cxf/blob/3d747fa0/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
index f6bf716..c4a4dc1 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSTokenValidator.java
@@ -166,7 +166,7 @@ public class STSTokenValidator implements Validator {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity");
}
}
@@ -188,7 +188,7 @@ public class STSTokenValidator implements Validator {
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity");
}
}
return false;