cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Add a way to enable credential delegation via a property
Date Fri, 08 Aug 2014 10:18:05 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 3791ba61c -> e86ad8d19


Add a way to enable credential delegation via a property


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e86ad8d1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e86ad8d1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e86ad8d1

Branch: refs/heads/3.0.x-fixes
Commit: e86ad8d196682fc3f59b5153f0b99852664331f8
Parents: 3791ba6
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Aug 8 11:16:35 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Aug 8 11:17:56 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/ws/security/SecurityConstants.java    | 11 ++++++++++-
 .../apache/cxf/ws/security/kerberos/KerberosUtils.java   |  7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e86ad8d1/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
index 2aa04e0..0669561 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
@@ -208,6 +208,15 @@ public final class SecurityConstants {
      */
     public static final String RETURN_SECURITY_ERROR = "ws-security.return.security.error";
     
+    /**
+     * Whether to use credential delegation or not in the KerberosClient. If this is set
to "true",
+     * then it tries to get a GSSCredential Object from the Message Context using the 
+     * DELEGATED_CREDENTIAL configuration tag below, and then use this to obtain a service
ticket.
+     * The default is "false".
+     */
+    public static final String KERBEROS_USE_CREDENTIAL_DELEGATION = 
+        "ws-security.kerberos.use.credential.delegation";
+    
     //
     // Non-boolean WS-Security Configuration parameters
     //
@@ -586,7 +595,7 @@ public final class SecurityConstants {
             ASYMMETRIC_SIGNATURE_ALGORITHM, PASSWORD_ENCRYPTOR_INSTANCE, ENABLE_SAML_ONE_TIME_USE_CACHE,
             SAML_ONE_TIME_USE_CACHE_INSTANCE, ENABLE_STREAMING_SECURITY, RETURN_SECURITY_ERROR,
             CACHE_IDENTIFIER, CACHE_ISSUED_TOKEN_IN_ENDPOINT, PREFER_WSMEX_OVER_STS_CLIENT_CONFIG,
-            DELEGATED_CREDENTIAL
+            DELEGATED_CREDENTIAL, KERBEROS_USE_CREDENTIAL_DELEGATION
         }));
         ALL_PROPERTIES = Collections.unmodifiableSet(s);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e86ad8d1/rt/ws/security/src/main/java/org/apache/cxf/ws/security/kerberos/KerberosUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/kerberos/KerberosUtils.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/kerberos/KerberosUtils.java
index 63a7287..42f4794 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/kerberos/KerberosUtils.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/kerberos/KerberosUtils.java
@@ -23,6 +23,7 @@ import javax.security.auth.callback.CallbackHandler;
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.ws.security.SecurityConstants;
 
 /**
@@ -48,9 +49,15 @@ public final class KerberosUtils {
                 getCallbackHandler(
                     message.getContextualProperty(SecurityConstants.CALLBACK_HANDLER)
                 );
+            boolean useCredentialDelegation = 
+                MessageUtils.getContextualBoolean(message, 
+                                              SecurityConstants.KERBEROS_USE_CREDENTIAL_DELEGATION,

+                                              false);
+            
             client.setContextName(jaasContext);
             client.setServiceName(kerberosSpn);
             client.setCallbackHandler(callbackHandler);
+            client.setUseDelegatedCredential(useCredentialDelegation);
         }
         return client;
     }


Mime
View raw message