directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-450 Allow to pass KdcOption related options from KinitTool down to KrbClient. Contributed by Steve.
Date Thu, 19 Nov 2015 01:47:53 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master d18ad29cc -> 02e97e8ef


DIRKRB-450 Allow to pass KdcOption related options from KinitTool down to KrbClient. Contributed
by Steve.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/02e97e8e
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/02e97e8e
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/02e97e8e

Branch: refs/heads/master
Commit: 02e97e8ef8a833a6ef0a4a968de4353ede30b913
Parents: d18ad29
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Nov 19 09:54:16 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Nov 19 09:54:16 2015 +0800

----------------------------------------------------------------------
 .../kerb/client/impl/AbstractInternalKrbClient.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/02e97e8e/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
index 40d1827..2bcbcc9 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
@@ -35,6 +35,8 @@ import org.apache.kerby.kerberos.kerb.client.request.TgsRequestWithTgt;
 import org.apache.kerby.kerberos.kerb.client.request.TgsRequestWithToken;
 import org.apache.kerby.kerberos.kerb.spec.base.NameType;
 import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
+import org.apache.kerby.kerberos.kerb.spec.kdc.KdcOption;
+import org.apache.kerby.kerberos.kerb.spec.kdc.KdcOptions;
 import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 
@@ -108,6 +110,19 @@ public abstract class AbstractInternalKrbClient implements InternalKrbClient
{
             asRequest.setServerPrincipal(serverPrincipal);
         }
 
+        KdcOptions kdcOptions = new KdcOptions();
+        for (KOption koption: requestOptions.getOptions()) {
+            try {
+              KdcOption kdcOption = KdcOption.valueOf(koption.getOptionName());
+              kdcOptions.setFlag(kdcOption, requestOptions.getBooleanOption(koption, false));
+            } catch (IllegalArgumentException | NullPointerException e) {
+              // It's completely acceptable that a request option is NOT a KdcOption
+              // but PMD doesn't like empty finally or catch blocks - here's a message
+              // just for you!
+              e.getMessage();
+            }
+        }
+        asRequest.setKdcOptions(kdcOptions);
         asRequest.setKrbOptions(requestOptions);
 
         return doRequestTgtTicket(asRequest);


Mime
View raw message