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/12 12:04:26 UTC
svn commit: r1724201 - in
/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src:
main/java/org/apache/wss4j/stax/impl/processor/input/
main/java/org/apache/wss4j/stax/impl/processor/output/
test/java/org/apache/wss4j/stax/test/
Author: coheigea
Date: Tue Jan 12 11:04:25 2016
New Revision: 1724201
URL: http://svn.apache.org/viewvc?rev=1724201&view=rev
Log:
More checkstyle work
Modified:
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityContextTokenOutputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java Tue Jan 12 11:04:25 2016
@@ -79,10 +79,10 @@ import org.apache.xml.security.stax.secu
*/
public class DecryptInputProcessor extends AbstractDecryptInputProcessor {
- private static final transient org.slf4j.Logger log =
+ private static final transient org.slf4j.Logger LOG =
org.slf4j.LoggerFactory.getLogger(DecryptInputProcessor.class);
- private static final Long maximumAllowedDecompressedBytes =
+ private static final Long MAX_ALLOWED_DECOMPRESSED_BYTES =
Long.valueOf(ConfigurationProperties.getProperty("MaximumAllowedDecompressedBytes"));
private List<DeferredAttachment> attachmentReferences = new ArrayList<>();
@@ -139,8 +139,7 @@ public class DecryptInputProcessor exten
try {
Constructor<InputStream> constructor = transformerClass.getConstructor(InputStream.class);
inputStream = new LimitingInputStream(
- constructor.newInstance(inputStream),
- maximumAllowedDecompressedBytes);
+ constructor.newInstance(inputStream), MAX_ALLOWED_DECOMPRESSED_BYTES);
} catch (InvocationTargetException | NoSuchMethodException
| InstantiationException | IllegalAccessException e) {
throw new XMLSecurityException(e);
@@ -180,9 +179,9 @@ public class DecryptInputProcessor exten
Cipher cipher, InboundSecurityToken inboundSecurityToken) throws XMLSecurityException {
String typeStr = encryptedDataType.getType();
- if (typeStr != null &&
- (WSSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY.equals(typeStr) ||
- WSSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE.equals(typeStr))) {
+ if (typeStr != null
+ && (WSSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY.equals(typeStr)
+ || WSSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE.equals(typeStr))) {
CipherReferenceType cipherReferenceType = encryptedDataType.getCipherData().getCipherReference();
if (cipherReferenceType == null) {
@@ -215,7 +214,7 @@ public class DecryptInputProcessor exten
String encryptionAlgorithm = encryptedDataType.getEncryptionMethod().getAlgorithm();
if (this.getSecurityProperties().getEncryptionSymAlgorithm() != null
&& !this.getSecurityProperties().getEncryptionSymAlgorithm().equals(encryptionAlgorithm)) {
- log.debug(
+ LOG.debug(
"The Key encryption method does not match the requirement"
);
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
@@ -252,8 +251,8 @@ public class DecryptInputProcessor exten
List<ReferenceType> processedReferences = getProcessedReferences();
if (references != null) {
Iterator<Map.Entry<String,ReferenceType>> iterator = references.entrySet().iterator();
- while(iterator.hasNext()){
- Map.Entry<String,ReferenceType> next = iterator.next();
+ while (iterator.hasNext()) {
+ Map.Entry<String, ReferenceType> next = iterator.next();
final ReferenceType referenceType = next.getValue();
String uri = WSSUtils.dropReferenceMarker(referenceType.getURI());
@@ -346,7 +345,7 @@ public class DecryptInputProcessor exten
}
}
- private class DeferredAttachment {
+ private final class DeferredAttachment {
private EncryptedDataType encryptedDataType;
private Cipher cipher;
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java Tue Jan 12 11:04:25 2016
@@ -101,15 +101,15 @@ import org.w3c.dom.Node;
*/
public class SAMLTokenInputHandler extends AbstractInputSecurityHeaderHandler {
- private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ private static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
- private static final List<QName> saml1TokenPath = new ArrayList<>(WSSConstants.WSSE_SECURITY_HEADER_PATH);
- private static final List<QName> saml2TokenPath = new ArrayList<>(WSSConstants.WSSE_SECURITY_HEADER_PATH);
+ private static final List<QName> SAML1_TOKEN_PATH = new ArrayList<>(WSSConstants.WSSE_SECURITY_HEADER_PATH);
+ private static final List<QName> SAML2_TOKEN_PATH = new ArrayList<>(WSSConstants.WSSE_SECURITY_HEADER_PATH);
static {
- documentBuilderFactory.setNamespaceAware(true);
- saml1TokenPath.add(WSSConstants.TAG_saml_Assertion);
- saml2TokenPath.add(WSSConstants.TAG_saml2_Assertion);
+ DOC_BUILDER_FACTORY.setNamespaceAware(true);
+ SAML1_TOKEN_PATH.add(WSSConstants.TAG_saml_Assertion);
+ SAML2_TOKEN_PATH.add(WSSConstants.TAG_saml2_Assertion);
}
@Override
@@ -283,23 +283,22 @@ public class SAMLTokenInputHandler exten
XMLSecEvent xmlSecEvent = xmlSecEventIterator.next();
idx++;
switch (xmlSecEvent.getEventType()) {
- case XMLStreamConstants.START_ELEMENT: {
+ case XMLStreamConstants.START_ELEMENT:
QName elementName = xmlSecEvent.asStartElement().getName();
if (WSSConstants.TAG_dsig_KeyInfo.equals(elementName)) {
List<QName> elementPath = xmlSecEvent.asStartElement().getElementPath();
if (elementPath.size() >= 4) {
int lastIndex = elementPath.size() - 2;
- if ("SubjectConfirmationData".equals(elementPath.get(lastIndex).getLocalPart()) &&
- "SubjectConfirmation".equals(elementPath.get(lastIndex - 1).getLocalPart()) &&
- "Subject".equals(elementPath.get(lastIndex - 2).getLocalPart())) {
+ if ("SubjectConfirmationData".equals(elementPath.get(lastIndex).getLocalPart())
+ && "SubjectConfirmation".equals(elementPath.get(lastIndex - 1).getLocalPart())
+ && "Subject".equals(elementPath.get(lastIndex - 2).getLocalPart())) {
return idx;
- } else if ("SubjectConfirmation".equals(elementPath.get(lastIndex).getLocalPart()) &&
- "Subject".equals(elementPath.get(lastIndex - 1).getLocalPart())) {
+ } else if ("SubjectConfirmation".equals(elementPath.get(lastIndex).getLocalPart())
+ && "Subject".equals(elementPath.get(lastIndex - 1).getLocalPart())) {
return idx;
}
}
}
- }
}
}
return idx;
@@ -312,19 +311,18 @@ public class SAMLTokenInputHandler exten
XMLSecEvent xmlSecEvent = xmlSecEventIterator.next();
idx++;
switch (xmlSecEvent.getEventType()) {
- case XMLStreamConstants.START_ELEMENT: {
+ case XMLStreamConstants.START_ELEMENT:
QName elementName = xmlSecEvent.asStartElement().getName();
if (WSSConstants.TAG_dsig_KeyInfo.equals(elementName)) {
List<QName> elementPath = xmlSecEvent.asStartElement().getElementPath();
if (elementPath.size() >= 4) {
int lastIndex = elementPath.size() - 2;
- if ("Signature".equals(elementPath.get(lastIndex).getLocalPart()) &&
- "Assertion".equals(elementPath.get(lastIndex - 1).getLocalPart())) {
+ if ("Signature".equals(elementPath.get(lastIndex).getLocalPart())
+ && "Assertion".equals(elementPath.get(lastIndex - 1).getLocalPart())) {
return idx;
}
}
}
- }
}
}
return idx;
@@ -353,8 +351,8 @@ public class SAMLTokenInputHandler exten
final XMLSecStartElement xmlSecStartElement = xmlSecEvent.asStartElement();
final QName elementName = xmlSecStartElement.getName();
- if (WSSConstants.TAG_wst_BinarySecret.equals(elementName) ||
- WSSConstants.TAG_wst0512_BinarySecret.equals(elementName)) {
+ if (WSSConstants.TAG_wst_BinarySecret.equals(elementName)
+ || WSSConstants.TAG_wst0512_BinarySecret.equals(elementName)) {
final StringBuilder stringBuilder = new StringBuilder();
loop:
@@ -458,7 +456,7 @@ public class SAMLTokenInputHandler exten
throws XMLSecurityException {
Document document;
try {
- document = documentBuilderFactory.newDocumentBuilder().newDocument();
+ document = DOC_BUILDER_FACTORY.newDocumentBuilder().newDocument();
} catch (ParserConfigurationException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN, e);
}
@@ -608,12 +606,11 @@ public class SAMLTokenInputHandler exten
if (elementPath.equals(WSSConstants.SOAP_11_BODY_PATH)) {
bodySignedPartSecurityEvent = signedPartSecurityEvent;
}
- }
- else if (WSSecurityEventConstants.SignedElement.equals(securityEvent.getSecurityEventType())) {
+ } else if (WSSecurityEventConstants.SignedElement.equals(securityEvent.getSecurityEventType())) {
SignedElementSecurityEvent signedPartSecurityEvent = (SignedElementSecurityEvent) securityEvent;
List<QName> elementPath = signedPartSecurityEvent.getElementPath();
- if (elementPath.equals(saml2TokenPath) || elementPath.equals(saml1TokenPath)) {
+ if (elementPath.equals(SAML2_TOKEN_PATH) || elementPath.equals(SAML1_TOKEN_PATH)) {
samlTokenSignedElementSecurityEvents.add(signedPartSecurityEvent);
}
}
@@ -703,8 +700,8 @@ public class SAMLTokenInputHandler exten
PublicKey publicKey = securityToken.getPublicKey();
Map<String, Key> keyMap = securityToken.getSecretKey();
if (x509Certificates != null && x509Certificates.length > 0
- && subjectCertificates != null && subjectCertificates.length > 0 &&
- subjectCertificates[0].equals(x509Certificates[0])) {
+ && subjectCertificates != null && subjectCertificates.length > 0
+ && subjectCertificates[0].equals(x509Certificates[0])) {
return;
}
if (publicKey != null && publicKey.equals(subjectPublicKey)) {
@@ -737,16 +734,16 @@ public class SAMLTokenInputHandler exten
SignedElementSecurityEvent samlTokenSignedElementSecurityEvent = null;
for (int j = 0; j < samlTokenSignedElementSecurityEvents.size(); j++) {
SignedElementSecurityEvent signedElementSecurityEvent = samlTokenSignedElementSecurityEvents.get(j);
- if (securityTokenProvider.getSecurityToken().getXMLSecEvent() ==
- signedElementSecurityEvent.getXmlSecEvent()) {
+ if (securityTokenProvider.getSecurityToken().getXMLSecEvent()
+ == signedElementSecurityEvent.getXmlSecEvent()) {
samlTokenSignedElementSecurityEvent = signedElementSecurityEvent;
}
}
- if (bodySignedPartSecurityEvent != null &&
- samlTokenSignedElementSecurityEvent != null &&
- bodySignedPartSecurityEvent.getSecurityToken() ==
- samlTokenSignedElementSecurityEvent.getSecurityToken()) {
+ if (bodySignedPartSecurityEvent != null
+ && samlTokenSignedElementSecurityEvent != null
+ && bodySignedPartSecurityEvent.getSecurityToken()
+ == samlTokenSignedElementSecurityEvent.getSecurityToken()) {
return;
}
methodNotSatisfied = true;
@@ -777,11 +774,11 @@ public class SAMLTokenInputHandler exten
private boolean containsSignature(List<TokenUsage> tokenUses) {
return tokenUses.contains(WSSecurityTokenConstants.TokenUsage_MainSignature)
- || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_Signature)
- || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_EndorsingEncryptedSupportingTokens)
- || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_EndorsingSupportingTokens)
- || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_SignedEndorsingEncryptedSupportingTokens)
- || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_SignedEndorsingSupportingTokens);
+ || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_Signature)
+ || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_EndorsingEncryptedSupportingTokens)
+ || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_EndorsingSupportingTokens)
+ || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_SignedEndorsingEncryptedSupportingTokens)
+ || tokenUses.contains(WSSecurityTokenConstants.TokenUsage_SignedEndorsingSupportingTokens);
}
}
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSEncryptedKeyInputHandler.java Tue Jan 12 11:04:25 2016
@@ -40,7 +40,7 @@ import org.apache.wss4j.stax.ext.WSSSecu
*/
public class WSSEncryptedKeyInputHandler extends XMLEncryptedKeyInputHandler {
- private static final transient org.slf4j.Logger log =
+ private static final transient org.slf4j.Logger LOG =
org.slf4j.LoggerFactory.getLogger(WSSEncryptedKeyInputHandler.class);
@Override
@@ -55,7 +55,7 @@ public class WSSEncryptedKeyInputHandler
&& encryptionMethodType != null) {
String encryptionMethod = encryptionMethodType.getAlgorithm();
if (!securityProperties.getEncryptionKeyTransportAlgorithm().equals(encryptionMethod)) {
- log.debug(
+ LOG.debug(
"The Key transport method does not match the requirement"
);
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureInputHandler.java Tue Jan 12 11:04:25 2016
@@ -52,7 +52,7 @@ import org.apache.xml.security.stax.secu
public class WSSSignatureInputHandler extends AbstractSignatureInputHandler {
- private static final transient org.slf4j.Logger log =
+ private static final transient org.slf4j.Logger LOG =
org.slf4j.LoggerFactory.getLogger(WSSSignatureInputHandler.class);
@Override
@@ -68,7 +68,7 @@ public class WSSSignatureInputHandler ex
String algorithm = signatureType.getSignedInfo().getSignatureMethod().getAlgorithm();
if (securityProperties.getSignatureAlgorithm() != null
&& !securityProperties.getSignatureAlgorithm().equals(algorithm)) {
- log.debug(
+ LOG.debug(
"The Signature method does not match the requirement"
);
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java Tue Jan 12 11:04:25 2016
@@ -217,11 +217,11 @@ public class WSSSignatureReferenceVerify
&& !WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS.equals(algorithm)
&& !WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS.equals(algorithm)) {
securityContext.handleBSPRule(BSPRule.R5423);
- if (j == transformTypes.size() - 1 &&
- !WSSConstants.NS_C14N_EXCL.equals(algorithm)
- && !WSSConstants.SOAPMESSAGE_NS10_STRTransform.equals(algorithm)
- && !WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS.equals(algorithm)
- && !WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS.equals(algorithm)) {
+ if (j == transformTypes.size() - 1
+ && !WSSConstants.NS_C14N_EXCL.equals(algorithm)
+ && !WSSConstants.SOAPMESSAGE_NS10_STRTransform.equals(algorithm)
+ && !WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS.equals(algorithm)
+ && !WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS.equals(algorithm)) {
securityContext.handleBSPRule(BSPRule.R5412);
}
InclusiveNamespaces inclusiveNamespacesType =
@@ -313,8 +313,8 @@ public class WSSSignatureReferenceVerify
((WSSSecurityProperties)getSecurityProperties()).getTimestampReplayCache();
if (timestampSecurityEvent != null && replayCache != null) {
final String cacheKey =
- timestampSecurityEvent.getCreated().getTimeInMillis() +
- "" + Arrays.hashCode(getSignatureType().getSignatureValue().getValue());
+ timestampSecurityEvent.getCreated().getTimeInMillis()
+ + "" + Arrays.hashCode(getSignatureType().getSignatureValue().getValue());
if (replayCache.contains(cacheKey)) {
throw new WSSecurityException(WSSecurityException.ErrorCode.MESSAGE_EXPIRED);
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java Tue Jan 12 11:04:25 2016
@@ -257,7 +257,7 @@ public class EncryptOutputProcessor exte
String encryptionSymAlgorithm = getSecurityProperties().getEncryptionSymAlgorithm();
String jceAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(encryptionSymAlgorithm);
if (jceAlgorithm == null) {
- throw new XMLSecurityException("algorithms.NoSuchMap", new Object[] { encryptionSymAlgorithm });
+ throw new XMLSecurityException("algorithms.NoSuchMap", new Object[] {encryptionSymAlgorithm});
}
//initialize the cipher
Cipher cipher = null;
@@ -356,9 +356,9 @@ public class EncryptOutputProcessor exte
Iterator<Attribute> attributeIterator = getXmlSecStartElement().getAttributes();
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();
- if (!attribute.isNamespace() &&
- (WSSConstants.NS_SOAP11.equals(attribute.getName().getNamespaceURI()) ||
- WSSConstants.NS_SOAP12.equals(attribute.getName().getNamespaceURI()))) {
+ if (!attribute.isNamespace()
+ && (WSSConstants.NS_SOAP11.equals(attribute.getName().getNamespaceURI())
+ || WSSConstants.NS_SOAP12.equals(attribute.getName().getNamespaceURI()))) {
attributes.add(createAttribute(attribute.getName(), attribute.getValue()));
}
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java Tue Jan 12 11:04:25 2016
@@ -118,8 +118,8 @@ public class EncryptedKeyOutputProcessor
finalEncryptedKeyOutputProcessor.addAfterProcessor(EncryptEndingOutputProcessor.class.getName());
//hint for the headerReordering processor where to place the EncryptedKey
- if (getSecurityProperties().getActions().indexOf(WSSConstants.ENCRYPT) <
- getSecurityProperties().getActions().indexOf(WSSConstants.SIGNATURE)) {
+ if (getSecurityProperties().getActions().indexOf(WSSConstants.ENCRYPT)
+ < getSecurityProperties().getActions().indexOf(WSSConstants.SIGNATURE)) {
finalEncryptedKeyOutputProcessor.addBeforeProcessor(WSSSignatureOutputProcessor.class.getName());
finalEncryptedKeyOutputProcessor.setAction(WSSConstants.SIGNATURE);
}
@@ -151,8 +151,8 @@ public class EncryptedKeyOutputProcessor
finalEncryptedKeyOutputProcessor.addAfterProcessor(EncryptEndingOutputProcessor.class.getName());
//hint for the headerReordering processor where to place the EncryptedKey
- if (getSecurityProperties().getActions().indexOf(WSSConstants.ENCRYPT_WITH_DERIVED_KEY) <
- getSecurityProperties().getActions().indexOf(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+ if (getSecurityProperties().getActions().indexOf(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)
+ < getSecurityProperties().getActions().indexOf(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
finalEncryptedKeyOutputProcessor.setAction(WSSConstants.SIGNATURE_WITH_DERIVED_KEY);
}
finalEncryptedKeyOutputProcessor.setOutputReferenceList(false);
@@ -220,8 +220,8 @@ public class EncryptedKeyOutputProcessor
final String encryptionKeyTransportMGFAlgorithm = getSecurityProperties().getEncryptionKeyTransportMGFAlgorithm();
- if (XMLSecurityConstants.NS_XENC11_RSAOAEP.equals(encryptionKeyTransportAlgorithm) ||
- XMLSecurityConstants.NS_XENC_RSAOAEPMGF1P.equals(encryptionKeyTransportAlgorithm)) {
+ if (XMLSecurityConstants.NS_XENC11_RSAOAEP.equals(encryptionKeyTransportAlgorithm)
+ || XMLSecurityConstants.NS_XENC_RSAOAEPMGF1P.equals(encryptionKeyTransportAlgorithm)) {
byte[] oaepParams = getSecurityProperties().getEncryptionKeyTransportOAEPParams();
if (oaepParams != null) {
@@ -266,8 +266,8 @@ public class EncryptedKeyOutputProcessor
Cipher cipher = Cipher.getInstance(jceid);
AlgorithmParameterSpec algorithmParameterSpec = null;
- if (XMLSecurityConstants.NS_XENC11_RSAOAEP.equals(encryptionKeyTransportAlgorithm) ||
- XMLSecurityConstants.NS_XENC_RSAOAEPMGF1P.equals(encryptionKeyTransportAlgorithm)) {
+ if (XMLSecurityConstants.NS_XENC11_RSAOAEP.equals(encryptionKeyTransportAlgorithm)
+ || XMLSecurityConstants.NS_XENC_RSAOAEPMGF1P.equals(encryptionKeyTransportAlgorithm)) {
String jceDigestAlgorithm = "SHA-1";
String encryptionKeyTransportDigestAlgorithm =
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java Tue Jan 12 11:04:25 2016
@@ -427,8 +427,9 @@ public class SAMLTokenOutputProcessor ex
}
private boolean includeBST() {
- if (senderVouches && getSecurityProperties().getSignatureKeyIdentifier() ==
- WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference
+ if (senderVouches
+ && getSecurityProperties().getSignatureKeyIdentifier()
+ == WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference
&& securityToken != null
&& !(WSSConstants.SAML_TOKEN_SIGNED.equals(action)
&& ((WSSSecurityProperties)getSecurityProperties()).isIncludeSignatureToken())) {
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityContextTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityContextTokenOutputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityContextTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityContextTokenOutputProcessor.java Tue Jan 12 11:04:25 2016
@@ -1,5 +1,5 @@
/**
- * Licensed to the Apache Software Foundation (ASF) under one
+ * 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
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java Tue Jan 12 11:04:25 2016
@@ -53,7 +53,7 @@ import org.apache.xml.security.stax.impl
*/
public class SecurityHeaderReorderProcessor extends AbstractOutputProcessor {
- final private Map<XMLSecurityConstants.Action, Map<SecurityHeaderOrder, Deque<XMLSecEvent>>> actionEventMap =
+ private final Map<XMLSecurityConstants.Action, Map<SecurityHeaderOrder, Deque<XMLSecEvent>>> actionEventMap =
new LinkedHashMap<XMLSecurityConstants.Action, Map<SecurityHeaderOrder, Deque<XMLSecEvent>>>();
private int securityHeaderIndex = 0;
@@ -91,8 +91,8 @@ public class SecurityHeaderReorderProces
throws XMLStreamException, XMLSecurityException {
int documentLevel = xmlSecEvent.getDocumentLevel();
- if (documentLevel < 3 ||
- !WSSUtils.isInSecurityHeader(xmlSecEvent, ((WSSSecurityProperties) getSecurityProperties()).getActor())) {
+ if (documentLevel < 3
+ || !WSSUtils.isInSecurityHeader(xmlSecEvent, ((WSSSecurityProperties) getSecurityProperties()).getActor())) {
outputProcessorChain.processEvent(xmlSecEvent);
return;
}
@@ -161,13 +161,13 @@ public class SecurityHeaderReorderProces
List<SecurityHeaderOrder> securityHeaderOrderList =
outputProcessorChain.getSecurityContext().getAsList(SecurityHeaderOrder.class);
SecurityHeaderOrder securityHeaderOrder = securityHeaderOrderList.get(securityHeaderIndex);
- if (!xmlSecStartElement.getName().equals(WSSConstants.TAG_xenc_EncryptedData) &&
- !xmlSecStartElement.getName().equals(securityHeaderOrder.getSecurityHeaderElementName())) {
+ if (!xmlSecStartElement.getName().equals(WSSConstants.TAG_xenc_EncryptedData)
+ && !xmlSecStartElement.getName().equals(securityHeaderOrder.getSecurityHeaderElementName())) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "empty",
- new Object[] {"Invalid security header order. Expected " +
- securityHeaderOrder.getSecurityHeaderElementName() +
- " but got " + xmlSecStartElement.getName()});
+ new Object[] {"Invalid security header order. Expected "
+ + securityHeaderOrder.getSecurityHeaderElementName()
+ + " but got " + xmlSecStartElement.getName()});
}
Map<SecurityHeaderOrder, Deque<XMLSecEvent>> map = actionEventMap.get(securityHeaderOrder.getAction());
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java Tue Jan 12 11:04:25 2016
@@ -206,10 +206,12 @@ public class WSSSignatureEndingOutputPro
attributes.add(createAttribute(WSSConstants.ATT_NULL_Algorithm, transforms[0]));
createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_dsig_Transform, false, attributes);
if (transforms.length >= 2) {
- createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsse_TransformationParameters, false, null);
+ createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsse_TransformationParameters,
+ false, null);
attributes = new ArrayList<>(1);
attributes.add(createAttribute(WSSConstants.ATT_NULL_Algorithm, transforms[1]));
- createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_dsig_CanonicalizationMethod, false, attributes);
+ createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_dsig_CanonicalizationMethod,
+ false, attributes);
createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_dsig_CanonicalizationMethod);
createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsse_TransformationParameters);
}
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java?rev=1724201&r1=1724200&r2=1724201&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java Tue Jan 12 11:04:25 2016
@@ -782,7 +782,7 @@ public abstract class AbstractTestBase e
}
public static long changeValueOfMaximumAllowedDecompressedBytes(Long value) throws NoSuchFieldException, IllegalAccessException {
- Field field = DecryptInputProcessor.class.getDeclaredField("maximumAllowedDecompressedBytes");
+ Field field = DecryptInputProcessor.class.getDeclaredField("MAX_ALLOWED_DECOMPRESSED_BYTES");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");