cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1132955 - in /cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider: operation/impl/SAMLTokenIssueOperation.java token/SAMLTokenIssueOperation.java
Date Tue, 07 Jun 2011 11:03:12 GMT
Author: coheigea
Date: Tue Jun  7 11:03:12 2011
New Revision: 1132955

URL: http://svn.apache.org/viewvc?rev=1132955&view=rev
Log:
Update the (un) attached references that the STS returns with the correct TokenType/ValueType
attributes.

Modified:
    cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/operation/impl/SAMLTokenIssueOperation.java
    cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/token/SAMLTokenIssueOperation.java

Modified: cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/operation/impl/SAMLTokenIssueOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/operation/impl/SAMLTokenIssueOperation.java?rev=1132955&r1=1132954&r2=1132955&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/operation/impl/SAMLTokenIssueOperation.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/operation/impl/SAMLTokenIssueOperation.java
Tue Jun  7 11:03:12 2011
@@ -73,6 +73,7 @@ import org.apache.cxf.ws.security.sts.pr
 import org.apache.cxf.ws.security.sts.provider.model.xmldsig.KeyInfoType;
 import org.apache.cxf.ws.security.sts.provider.model.xmldsig.X509DataType;
 import org.apache.cxf.ws.security.sts.provider.operation.IssueOperation;
+import org.apache.ws.security.WSConstants;
 import org.apache.xml.security.utils.Constants;
 import org.opensaml.common.xml.SAMLConstants;
 
@@ -90,6 +91,8 @@ public class SAMLTokenIssueOperation imp
     private static final String SIGN_FACTORY_TYPE = "DOM";
     private static final String JKS_INSTANCE = "JKS";
     private static final String X_509 = "X.509";
+    private static final QName TOKEN_TYPE = 
+        new QName(WSConstants.WSSE11_NS, WSConstants.TOKEN_TYPE, WSConstants.WSSE11_PREFIX);
 
     private static final QName QNAME_WST_TOKEN_TYPE = WS_TRUST_FACTORY
             .createTokenType("").getName();
@@ -236,6 +239,21 @@ public class SAMLTokenIssueOperation imp
         keyIdentifierType.setValue(tokenId);
         JAXBElement<KeyIdentifierType> keyIdentifier = WSSE_FACTORY
                 .createKeyIdentifier(keyIdentifierType);
+        
+        if (WSConstants.WSS_SAML_TOKEN_TYPE.equals(tokenType) ||
+            WSConstants.SAML_NS.equals(tokenType)) {
+            securityTokenReferenceType.getOtherAttributes().put(
+                TOKEN_TYPE, WSConstants.WSS_SAML_TOKEN_TYPE
+            );
+            keyIdentifierType.setValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
+        } else if (WSConstants.WSS_SAML2_TOKEN_TYPE.equals(tokenType)
+            || WSConstants.SAML2_NS.equals(tokenType)) {
+            securityTokenReferenceType.getOtherAttributes().put(
+                TOKEN_TYPE, WSConstants.WSS_SAML2_TOKEN_TYPE
+            );
+            keyIdentifierType.setValueType(WSConstants.WSS_SAML2_KI_VALUE_TYPE);
+        }
+        
         securityTokenReferenceType.getAny().add(keyIdentifier);
         requestedReferenceType
                 .setSecurityTokenReference(securityTokenReferenceType);

Modified: cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/token/SAMLTokenIssueOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/token/SAMLTokenIssueOperation.java?rev=1132955&r1=1132954&r2=1132955&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/token/SAMLTokenIssueOperation.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/provider/token/SAMLTokenIssueOperation.java
Tue Jun  7 11:03:12 2011
@@ -72,6 +72,7 @@ import org.apache.cxf.ws.security.sts.pr
 import org.apache.cxf.ws.security.sts.provider.model.xmldsig.KeyInfoType;
 import org.apache.cxf.ws.security.sts.provider.model.xmldsig.X509DataType;
 import org.apache.cxf.ws.security.sts.provider.operation.IssueOperation;
+import org.apache.ws.security.WSConstants;
 import org.apache.xml.security.utils.Constants;
 import org.opensaml.common.xml.SAMLConstants;
 
@@ -88,6 +89,8 @@ public class SAMLTokenIssueOperation imp
     private static final String SIGN_FACTORY_TYPE = "DOM";
     private static final String JKS_INSTANCE = "JKS";
     private static final String X_509 = "X.509";
+    private static final QName TOKEN_TYPE = 
+        new QName(WSConstants.WSSE11_NS, WSConstants.TOKEN_TYPE, WSConstants.WSSE11_PREFIX);
 
     private static final QName QNAME_WST_TOKEN_TYPE = WS_TRUST_FACTORY
             .createTokenType("").getName();
@@ -234,6 +237,21 @@ public class SAMLTokenIssueOperation imp
         keyIdentifierType.setValue(tokenId);
         JAXBElement<KeyIdentifierType> keyIdentifier = WSSE_FACTORY
                 .createKeyIdentifier(keyIdentifierType);
+        
+        if (WSConstants.WSS_SAML_TOKEN_TYPE.equals(tokenType) ||
+            WSConstants.SAML_NS.equals(tokenType)) {
+            securityTokenReferenceType.getOtherAttributes().put(
+                TOKEN_TYPE, WSConstants.WSS_SAML_TOKEN_TYPE
+            );
+            keyIdentifierType.setValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
+        } else if (WSConstants.WSS_SAML2_TOKEN_TYPE.equals(tokenType)
+            || WSConstants.SAML2_NS.equals(tokenType)) {
+            securityTokenReferenceType.getOtherAttributes().put(
+                TOKEN_TYPE, WSConstants.WSS_SAML2_TOKEN_TYPE
+            );
+            keyIdentifierType.setValueType(WSConstants.WSS_SAML2_KI_VALUE_TYPE);
+        }
+        
         securityTokenReferenceType.getAny().add(keyIdentifier);
         requestedReferenceType
                 .setSecurityTokenReference(securityTokenReferenceType);



Mime
View raw message