You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2016/01/05 11:53:26 UTC
svn commit: r1723039 - in /webservices/wss4j/branches/2_1_x-fixes:
ws-security-common/src/main/java/org/apache/wss4j/common/bsp/
ws-security-common/src/main/java/org/apache/wss4j/common/crypto/
ws-security-common/src/main/java/org/apache/wss4j/common/d...
Author: coheigea
Date: Tue Jan 5 10:53:26 2016
New Revision: 1723039
URL: http://svn.apache.org/viewvc?rev=1723039&view=rev
Log:
Checkstyle updates
Modified:
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPRule.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/DefaultSpnegoClientAction.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/SOAP12Constants.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSConstants.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/engine/WSSConfig.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/JAASUsernameTokenValidator.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPRule.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPRule.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPRule.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPRule.java Tue Jan 5 10:53:26 2016
@@ -22,6 +22,7 @@ package org.apache.wss4j.common.bsp;
/**
* A Basic Security Profile rule.
*/
+@SuppressWarnings("checkstyle:linelength")
public enum BSPRule {
R3203("A TIMESTAMP MUST contain exactly one CREATED"),
R3224("Any TIMESTAMP MUST NOT contain more than one EXPIRES"),
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java Tue Jan 5 10:53:26 2016
@@ -78,27 +78,22 @@ public class CertificateStore extends Cr
CryptoType.TYPE type = cryptoType.getType();
X509Certificate[] certs = null;
switch (type) {
- case ISSUER_SERIAL: {
+ case ISSUER_SERIAL:
certs = getX509Certificates(cryptoType.getIssuer(), cryptoType.getSerial());
break;
- }
- case THUMBPRINT_SHA1: {
+ case THUMBPRINT_SHA1:
certs = getX509Certificates(cryptoType.getBytes());
break;
- }
- case SKI_BYTES: {
+ case SKI_BYTES:
certs = getX509CertificatesSKI(cryptoType.getBytes());
break;
- }
case ALIAS:
- case SUBJECT_DN: {
+ case SUBJECT_DN:
certs = getX509CertificatesSubjectDN(cryptoType.getSubjectDN());
break;
- }
- case ENDPOINT: {
+ case ENDPOINT:
break;
}
- }
return certs;
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java Tue Jan 5 10:53:26 2016
@@ -94,17 +94,17 @@ public class Merlin extends CryptoBase {
* KeyStore configuration types
*/
public static final String KEYSTORE_FILE = "keystore.file";
- public static final String KEYSTORE_PASSWORD ="keystore.password";
- public static final String KEYSTORE_TYPE ="keystore.type";
- public static final String KEYSTORE_ALIAS ="keystore.alias";
- public static final String KEYSTORE_PRIVATE_PASSWORD ="keystore.private.password";
+ public static final String KEYSTORE_PASSWORD = "keystore.password";
+ public static final String KEYSTORE_TYPE = "keystore.type";
+ public static final String KEYSTORE_ALIAS = "keystore.alias";
+ public static final String KEYSTORE_PRIVATE_PASSWORD = "keystore.private.password";
/*
* TrustStore configuration types
*/
- public static final String LOAD_CA_CERTS ="load.cacerts";
- public static final String TRUSTSTORE_FILE ="truststore.file";
- public static final String TRUSTSTORE_PASSWORD ="truststore.password";
+ public static final String LOAD_CA_CERTS = "load.cacerts";
+ public static final String TRUSTSTORE_FILE = "truststore.file";
+ public static final String TRUSTSTORE_PASSWORD = "truststore.password";
public static final String TRUSTSTORE_TYPE = "truststore.type";
/*
@@ -555,30 +555,24 @@ public class Merlin extends CryptoBase {
CryptoType.TYPE type = cryptoType.getType();
X509Certificate[] certs = null;
switch (type) {
- case ISSUER_SERIAL: {
+ case ISSUER_SERIAL:
certs = getX509Certificates(cryptoType.getIssuer(), cryptoType.getSerial());
break;
- }
- case THUMBPRINT_SHA1: {
+ case THUMBPRINT_SHA1:
certs = getX509Certificates(cryptoType.getBytes());
break;
- }
- case SKI_BYTES: {
+ case SKI_BYTES:
certs = getX509CertificatesSKI(cryptoType.getBytes());
break;
- }
- case SUBJECT_DN: {
+ case SUBJECT_DN:
certs = getX509CertificatesSubjectDN(cryptoType.getSubjectDN());
break;
- }
- case ALIAS: {
+ case ALIAS:
certs = getX509Certificates(cryptoType.getAlias());
break;
- }
- case ENDPOINT: {
+ case ENDPOINT:
break;
}
- }
return certs;
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java Tue Jan 5 10:53:26 2016
@@ -32,7 +32,7 @@ public final class ThreadLocalSecurityPr
private static final long serialVersionUID = 3556396671069994931L;
private static final String NAME = "TLSP";
- private static final ThreadLocal<Provider> provider = new ThreadLocal<Provider>();
+ private static final ThreadLocal<Provider> PROVIDER = new ThreadLocal<Provider>();
private static boolean installed = false;
public static synchronized void install() {
@@ -55,15 +55,15 @@ public final class ThreadLocalSecurityPr
}
public static void setProvider(Provider p) {
- provider.set(p);
+ PROVIDER.set(p);
}
public static void unsetProvider() {
- provider.remove();
+ PROVIDER.remove();
}
private Provider getProvider() {
- return provider.get();
+ return PROVIDER.get();
}
public void clear() {
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java Tue Jan 5 10:53:26 2016
@@ -91,7 +91,7 @@ public class X509SubjectPublicKeyInfo ex
}
skip(algIDlen); // AlgorithmIdentifier contents
expect(TYPE_BIT_STRING); // subjectPublicKey BIT STRING
- int keyLen = getLength()-1;
+ int keyLen = getLength() - 1;
if (keyLen < 0) {
// Invalid BIT STRING length
throw new WSSecurityException(
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java Tue Jan 5 10:53:26 2016
@@ -56,7 +56,7 @@ public class P_SHA1 implements Derivatio
try {
Mac mac = Mac.getInstance("HmacSHA1");
- byte[] tempBytes = P_hash(secret, seed, mac, offset + (int) length);
+ byte[] tempBytes = pHash(secret, seed, mac, offset + (int) length);
byte[] key = new byte[(int) length];
@@ -78,7 +78,7 @@ public class P_SHA1 implements Derivatio
* @return a byte array that contains a secret key
* @throws InvalidKeyException
*/
- private static byte[] P_hash(byte[] secret, byte[] seed, Mac mac, int required)
+ private static byte[] pHash(byte[] secret, byte[] seed, Mac mac, int required)
throws InvalidKeyException {
byte[] out = new byte[required];
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/DefaultSpnegoClientAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/DefaultSpnegoClientAction.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/DefaultSpnegoClientAction.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/DefaultSpnegoClientAction.java Tue Jan 5 10:53:26 2016
@@ -60,7 +60,8 @@ public class DefaultSpnegoClientAction i
GSSManager gssManager = GSSManager.getInstance();
Oid oid = new Oid("1.3.6.1.5.5.2");
- GSSName gssService = gssManager.createName(serviceName, isUsernameServiceNameForm ? GSSName.NT_USER_NAME : GSSName.NT_HOSTBASED_SERVICE);
+ GSSName gssService = gssManager.createName(serviceName, isUsernameServiceNameForm
+ ? GSSName.NT_USER_NAME : GSSName.NT_HOSTBASED_SERVICE);
secContext = gssManager.createContext(gssService, oid, null, GSSContext.DEFAULT_LIFETIME);
secContext.requestMutualAuth(mutualAuth);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java Tue Jan 5 10:53:26 2016
@@ -184,7 +184,7 @@ public class SecurityTokenReference {
public void setKeyIdentifier(X509Certificate cert)
throws WSSecurityException {
Document doc = element.getOwnerDocument();
- byte data[] = null;
+ byte[] data = null;
try {
data = cert.getEncoded();
} catch (CertificateEncodingException e) {
@@ -223,7 +223,7 @@ public class SecurityTokenReference {
if (skiCrypto == null) {
skiCrypto = new Merlin();
}
- byte data[] = skiCrypto.getSKIBytesFromCert(cert);
+ byte[] data = skiCrypto.getSKIBytesFromCert(cert);
Text text = doc.createTextNode(Base64.encode(data));
createKeyIdentifier(doc, SKI_URI, text, true);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/SOAP12Constants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/SOAP12Constants.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/SOAP12Constants.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/SOAP12Constants.java Tue Jan 5 10:53:26 2016
@@ -29,12 +29,9 @@ public class SOAP12Constants implements
*
*/
private static final long serialVersionUID = 3784866613259361834L;
- private static final QName headerQName = new QName(WSConstants.URI_SOAP12_ENV,
- WSConstants.ELEM_HEADER);
- private static final QName bodyQName = new QName(WSConstants.URI_SOAP12_ENV,
- WSConstants.ELEM_BODY);
- private static final QName roleQName = new QName(WSConstants.URI_SOAP12_ENV,
- WSConstants.ATTR_ROLE);
+ private static final QName HEADER_QNAME = new QName(WSConstants.URI_SOAP12_ENV, WSConstants.ELEM_HEADER);
+ private static final QName BODY_QNAME = new QName(WSConstants.URI_SOAP12_ENV, WSConstants.ELEM_BODY);
+ private static final QName ROLE_QNAME = new QName(WSConstants.URI_SOAP12_ENV, WSConstants.ATTR_ROLE);
// Public constants for SOAP 1.2
@@ -48,18 +45,18 @@ public class SOAP12Constants implements
}
public QName getHeaderQName() {
- return headerQName;
+ return HEADER_QNAME;
}
public QName getBodyQName() {
- return bodyQName;
+ return BODY_QNAME;
}
/**
* Obtain the QName for the role attribute (actor/role)
*/
public QName getRoleAttributeQName() {
- return roleQName;
+ return ROLE_QNAME;
}
/**
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSConstants.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSConstants.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSConstants.java Tue Jan 5 10:53:26 2016
@@ -138,38 +138,32 @@ public final class WSConstants extends W
/**
* An error was discovered processing the <Security> header
*/
- public static final QName INVALID_SECURITY =
- new QName (WSSE_NS, "InvalidSecurity");
+ public static final QName INVALID_SECURITY = new QName(WSSE_NS, "InvalidSecurity");
/**
* An invalid security token was provided
*/
- public static final QName INVALID_SECURITY_TOKEN =
- new QName (WSSE_NS, "InvalidSecurityToken");
+ public static final QName INVALID_SECURITY_TOKEN = new QName(WSSE_NS, "InvalidSecurityToken");
/**
* The security token could not be authenticated or authorized
*/
- public static final QName FAILED_AUTHENTICATION =
- new QName (WSSE_NS, "FailedAuthentication");
+ public static final QName FAILED_AUTHENTICATION = new QName(WSSE_NS, "FailedAuthentication");
/**
* The signature or decryption was invalid
*/
- public static final QName FAILED_CHECK =
- new QName (WSSE_NS, "FailedCheck");
+ public static final QName FAILED_CHECK = new QName(WSSE_NS, "FailedCheck");
/**
* Referenced security token could not be retrieved
*/
- public static final QName SECURITY_TOKEN_UNAVAILABLE =
- new QName (WSSE_NS, "SecurityTokenUnavailable");
+ public static final QName SECURITY_TOKEN_UNAVAILABLE = new QName(WSSE_NS, "SecurityTokenUnavailable");
/**
* The message has expired
*/
- public static final QName MESSAGE_EXPIRED =
- new QName (WSSE_NS, "MessageExpired");
+ public static final QName MESSAGE_EXPIRED = new QName(WSSE_NS, "MessageExpired");
/*
* Constants used to configure WSS4J
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/engine/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/engine/WSSConfig.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/engine/WSSConfig.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/engine/WSSConfig.java Tue Jan 5 10:53:26 2016
@@ -55,13 +55,13 @@ import org.apache.xml.security.utils.res
* <p/> <b>WARNING: changing the default settings will break the compliance with
* the latest specs. Do this only if you know what you are doing.</b> <p/>
*/
-public class WSSConfig {
+public final class WSSConfig {
- public static final DatatypeFactory datatypeFactory;
+ public static final DatatypeFactory DATATYPE_FACTORY;
static {
try {
- datatypeFactory = DatatypeFactory.newInstance();
+ DATATYPE_FACTORY = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
throw new RuntimeException(e);
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java Tue Jan 5 10:53:26 2016
@@ -121,7 +121,7 @@ public class Timestamp {
XMLGregorianCalendar createdCalendar = null;
try {
createdCalendar =
- WSSConfig.datatypeFactory.newXMLGregorianCalendar(strCreated);
+ WSSConfig.DATATYPE_FACTORY.newXMLGregorianCalendar(strCreated);
} catch (IllegalArgumentException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
}
@@ -143,7 +143,7 @@ public class Timestamp {
XMLGregorianCalendar expiresCalendar = null;
try {
expiresCalendar =
- WSSConfig.datatypeFactory.newXMLGregorianCalendar(strExpires);
+ WSSConfig.DATATYPE_FACTORY.newXMLGregorianCalendar(strExpires);
} catch (IllegalArgumentException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java Tue Jan 5 10:53:26 2016
@@ -217,7 +217,7 @@ public class UsernameToken {
XMLGregorianCalendar createdCalendar = null;
try {
createdCalendar =
- WSSConfig.datatypeFactory.newXMLGregorianCalendar(createdString);
+ WSSConfig.DATATYPE_FACTORY.newXMLGregorianCalendar(createdString);
} catch (IllegalArgumentException e) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, e,
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java Tue Jan 5 10:53:26 2016
@@ -90,8 +90,8 @@ public class EncryptedKeyProcessor imple
String id = elem.getAttributeNS(null, "Id");
if (!"".equals(id)) {
WSSecurityEngineResult result = wsDocInfo.getResult(id);
- if (result != null &&
- WSConstants.ENCR == (Integer)result.get(WSSecurityEngineResult.TAG_ACTION)
+ if (result != null
+ && WSConstants.ENCR == (Integer)result.get(WSSecurityEngineResult.TAG_ACTION)
) {
return Collections.singletonList(result);
}
@@ -425,7 +425,8 @@ public class EncryptedKeyProcessor imple
} else if (WSConstants.X509_CERT_LN.equals(x509Child.getLocalName())) {
byte[] token = EncryptionUtils.getDecodedBase64EncodedData(x509Child);
if (token == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidCertData", new Object[] {"0"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidCertData",
+ new Object[] {"0"});
}
try (InputStream in = new ByteArrayInputStream(token)) {
X509Certificate cert = data.getDecCrypto().loadCertificate(in);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java Tue Jan 5 10:53:26 2016
@@ -231,8 +231,8 @@ public class ReferenceListProcessor impl
bspEnforcer.handleBSPRule(BSPRule.R5424);
}
- if (child == null || !WSConstants.WSSE_NS.equals(child.getNamespaceURI()) ||
- !SecurityTokenReference.SECURITY_TOKEN_REFERENCE.equals(child.getLocalName())) {
+ if (child == null || !WSConstants.WSSE_NS.equals(child.getNamespaceURI())
+ || !SecurityTokenReference.SECURITY_TOKEN_REFERENCE.equals(child.getLocalName())) {
bspEnforcer.handleBSPRule(BSPRule.R5426);
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java Tue Jan 5 10:53:26 2016
@@ -597,7 +597,8 @@ public class SignatureProcessor implemen
}
}
} else if (dereferencedData instanceof OctetStreamData) {
- se = doc.createElementNS("http://docs.oasis-open.org/wss/oasis-wss-SwAProfile-1.1", "attachment");
+ se = doc.createElementNS("http://docs.oasis-open.org/wss/oasis-wss-SwAProfile-1.1",
+ "attachment");
attachment = true;
}
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java Tue Jan 5 10:53:26 2016
@@ -232,13 +232,12 @@ public class WSSecSignatureSAML extends
cryptoType.setAlias(issuerKeyName);
certs = issuerCrypto.getX509Certificates(cryptoType);
wsDocInfo.setCrypto(issuerCrypto);
- }
- //
- // in case of key holder: - get the user's certificate that _must_ be
- // included in the SAML token. To ensure the cert integrity the SAML
- // token must be signed (by the issuer).
- //
- else {
+ } else {
+ //
+ // in case of key holder: - get the user's certificate that _must_ be
+ // included in the SAML token. To ensure the cert integrity the SAML
+ // token must be signed (by the issuer).
+ //
if (userCrypto == null || !samlAssertion.isSigned()) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/EncryptionUtils.java Tue Jan 5 10:53:26 2016
@@ -120,9 +120,9 @@ public final class EncryptionUtils {
// See if it is an attachment, and handle that differently
String typeStr = encData.getAttributeNS(null, "Type");
String xopURI = getXOPURIFromEncryptedData(encData);
- if (typeStr != null &&
- (WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY.equals(typeStr) ||
- WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE.equals(typeStr))) {
+ if (typeStr != null
+ && (WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY.equals(typeStr)
+ || WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE.equals(typeStr))) {
Element cipherData = XMLUtils.getDirectChildElement(encData, "CipherData", WSConstants.ENC_NS);
if (cipherData == null) {
@@ -328,9 +328,11 @@ public final class EncryptionUtils {
}
- private static Node decryptXopAttachment(SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler,
- String xopURI, Element encData) throws WSSecurityException, IOException,
- UnsupportedCallbackException, NoSuchAlgorithmException, NoSuchPaddingException, ParserConfigurationException, SAXException {
+ private static Node decryptXopAttachment(
+ SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler,
+ String xopURI, Element encData
+ ) throws WSSecurityException, IOException, UnsupportedCallbackException, NoSuchAlgorithmException,
+ NoSuchPaddingException, ParserConfigurationException, SAXException {
if (attachmentCallbackHandler == null) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java Tue Jan 5 10:53:26 2016
@@ -102,7 +102,8 @@ public final class WSSecurityUtil {
* Returns the first WS-Security header element for a given actor. Only one
* WS-Security header is allowed for an actor.
*/
- public static Element getSecurityHeader(Element soapHeader, String actor, boolean soap12) throws WSSecurityException {
+ public static Element getSecurityHeader(Element soapHeader, String actor, boolean soap12)
+ throws WSSecurityException {
String actorLocal = WSConstants.ATTR_ACTOR;
String soapNamespace = WSConstants.URI_SOAP11_ENV;
@@ -385,7 +386,7 @@ public final class WSSecurityUtil {
* @param data to encode
* @return a Text node containing the base64 encoded data
*/
- public static Text createBase64EncodedTextNode(Document doc, byte data[]) {
+ public static Text createBase64EncodedTextNode(Document doc, byte[] data) {
return doc.createTextNode(Base64.encode(data));
}
@@ -413,7 +414,7 @@ public final class WSSecurityUtil {
}
List<Integer> actions = new ArrayList<>();
- String single[] = actionToParse.split("\\s");
+ String[] single = actionToParse.split("\\s");
for (int i = 0; i < single.length; i++) {
if (single[i].equals(WSHandlerConstants.NO_SECURITY)) {
return actions;
@@ -467,7 +468,7 @@ public final class WSSecurityUtil {
}
List<HandlerAction> actions = new ArrayList<>();
- String single[] = action.split(" ");
+ String[] single = action.split(" ");
for (int i = 0; i < single.length; i++) {
if (single[i].equals(WSHandlerConstants.NO_SECURITY)) {
return actions;
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/JAASUsernameTokenValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/JAASUsernameTokenValidator.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/JAASUsernameTokenValidator.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/JAASUsernameTokenValidator.java Tue Jan 5 10:53:26 2016
@@ -91,7 +91,7 @@ public class JAASUsernameTokenValidator
if (!WSConstants.PASSWORD_TEXT.equals(pwType)) {
LOG.warn("Password type " + pwType + " not supported");
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
}
if (!(user != null && user.length() > 0 && password != null && password.length() > 0)) {
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java?rev=1723039&r1=1723038&r2=1723039&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java Tue Jan 5 10:53:26 2016
@@ -536,9 +536,9 @@ public class ModifiedRequestTest extends
DateFormat zulu = new XmlSchemaDateFormat();
XMLGregorianCalendar createdCalendar =
- WSSConfig.datatypeFactory.newXMLGregorianCalendar(createdValue.getTextContent());
+ WSSConfig.DATATYPE_FACTORY.newXMLGregorianCalendar(createdValue.getTextContent());
// Add 5 seconds
- Duration duration = WSSConfig.datatypeFactory.newDuration(5000L);
+ Duration duration = WSSConfig.DATATYPE_FACTORY.newDuration(5000L);
createdCalendar.add(duration);
Date createdDate = createdCalendar.toGregorianCalendar().getTime();
createdValue.setTextContent(zulu.format(createdDate));