You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/10/05 17:34:28 UTC
svn commit: r1004674 -
/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
Author: dkulp
Date: Tue Oct 5 15:34:28 2010
New Revision: 1004674
URL: http://svn.apache.org/viewvc?rev=1004674&view=rev
Log:
[CXF-2527] Fix for using relative references with wsc:Identifiers
Patch from Colm O'hEigeartaigh applied
Modified:
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1004674&r1=1004673&r2=1004674&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java Tue Oct 5 15:34:28 2010
@@ -424,7 +424,10 @@ public class SymmetricBindingHandler ext
} else {
if (attached) {
String id = encrTok.getWsuId();
- if (id == null) {
+ if (id == null && encrToken instanceof SecureConversationToken) {
+ dkEncr.setTokenIdDirectId(true);
+ id = encrTok.getId();
+ } else if (id == null) {
id = encrTok.getId();
}
if (id.startsWith("#")) {
@@ -432,6 +435,7 @@ public class SymmetricBindingHandler ext
}
dkEncr.setExternalKey(encrTok.getSecret(), id);
} else {
+ dkEncr.setTokenIdDirectId(true);
dkEncr.setExternalKey(encrTok.getSecret(), encrTok.getId());
}
}
@@ -439,6 +443,8 @@ public class SymmetricBindingHandler ext
if (encrTok.getSHA1() != null) {
dkEncr.setCustomValueType(WSConstants.SOAPMESSAGE_NS11 + "#"
+ WSConstants.ENC_KEY_VALUE_TYPE);
+ } else {
+ dkEncr.setCustomValueType(encrTok.getTokenType());
}
dkEncr.setSymmetricEncAlgorithm(sbinding.getAlgorithmSuite().getEncryption());
@@ -464,7 +470,10 @@ public class SymmetricBindingHandler ext
String encrTokId = encrTok.getId();
if (attached) {
encrTokId = encrTok.getWsuId();
- if (encrTokId == null) {
+ if (encrTokId == null && encrToken instanceof SecureConversationToken) {
+ encr.setEncKeyIdDirectId(true);
+ encrTokId = encrTok.getId();
+ } else if (encrTokId == null) {
encrTokId = encrTok.getId();
}
if (encrTokId.startsWith("#")) {
@@ -570,6 +579,9 @@ public class SymmetricBindingHandler ext
}
dkSign.setExternalKey(tok.getSecret(), tokenRef.getElement());
} else {
+ if (policyToken instanceof SecureConversationToken) {
+ dkSign.setTokenIdDirectId(true);
+ }
dkSign.setExternalKey(tok.getSecret(), tok.getId());
}
@@ -580,6 +592,8 @@ public class SymmetricBindingHandler ext
//Set the value type of the reference
dkSign.setCustomValueType(WSConstants.SOAPMESSAGE_NS11 + "#"
+ WSConstants.ENC_KEY_VALUE_TYPE);
+ } else {
+ dkSign.setCustomValueType(tok.getTokenType());
}
try {
@@ -652,6 +666,9 @@ public class SymmetricBindingHandler ext
if (included) {
sigTokId = tok.getWsuId();
if (sigTokId == null) {
+ if (policyToken instanceof SecureConversationToken) {
+ sig.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING_DIRECT);
+ }
sigTokId = tok.getId();
}
if (sigTokId.startsWith("#")) {