Author: coheigea
Date: Thu Jan 3 11:20:30 2013
New Revision: 1428285
URL: http://svn.apache.org/viewvc?rev=1428285&view=rev
Log:
[CXF-4728] - STS KeyIdentifier AttachedReference shouldn't use a URI fragment
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/asymmetric/cxf-service.xml
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java?rev=1428285&r1=1428284&r2=1428285&view=diff
==============================================================================
---
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
(original)
+++
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
Thu Jan 3 11:20:30 2013
@@ -189,14 +189,6 @@ public abstract class AbstractOperation
SecurityTokenReferenceType securityTokenReferenceType =
QNameConstants.WSSE_FACTORY.createSecurityTokenReferenceType();
- // Create the identifier according to whether it is an attached
reference or not
- String identifier = tokenReference.getIdentifier();
- if (attached && identifier.charAt(0) != '#') {
- identifier = "#" + identifier;
- } else if (!attached && identifier.charAt(0) == '#') {
- identifier = identifier.substring(1);
- }
-
// TokenType
String tokenType = tokenReference.getWsse11TokenType();
if (tokenType != null) {
@@ -204,6 +196,11 @@ public abstract class AbstractOperation
}
if (tokenReference.isUseKeyIdentifier()) {
+ String identifier = tokenReference.getIdentifier();
+ if (identifier.charAt(0) == '#') {
+ identifier = identifier.substring(1);
+ }
+
KeyIdentifierType keyIdentifierType =
QNameConstants.WSSE_FACTORY.createKeyIdentifierType();
keyIdentifierType.setValue(identifier);
@@ -215,6 +212,13 @@ public abstract class AbstractOperation
QNameConstants.WSSE_FACTORY.createKeyIdentifier(keyIdentifierType);
securityTokenReferenceType.getAny().add(keyIdentifier);
} else if (tokenReference.isUseDirectReference()) {
+ String identifier = tokenReference.getIdentifier();
+ if (attached && identifier.charAt(0) != '#') {
+ identifier = "#" + identifier;
+ } else if (!attached && identifier.charAt(0) == '#') {
+ identifier = identifier.substring(1);
+ }
+
ReferenceType referenceType =
QNameConstants.WSSE_FACTORY.createReferenceType();
referenceType.setURI(identifier);
Modified:
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/asymmetric/cxf-service.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/asymmetric/cxf-service.xml?rev=1428285&r1=1428284&r2=1428285&view=diff
==============================================================================
---
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/asymmetric/cxf-service.xml
(original)
+++
cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/asymmetric/cxf-service.xml
Thu Jan 3 11:20:30 2013
@@ -52,6 +52,7 @@
<entry key="ws-security.callback-handler"
value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
<entry key="ws-security.signature.properties"
value="serviceKeystore.properties"/>
+ <entry key="ws-security.is-bsp-compliant" value="false"/>
</jaxws:properties>
</jaxws:endpoint>