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-406 Add the anonymous PKINIT support in kinit tool.
Date Thu, 10 Sep 2015 02:49:47 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/pkinit-support f6067bfd1 -> b8c8819ae


DIRKRB-406 Add the anonymous PKINIT support in kinit tool.


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

Branch: refs/heads/pkinit-support
Commit: b8c8819ae901dab55487ca538fb26206946e3d90
Parents: f6067bf
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Sep 10 10:54:55 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Sep 10 10:54:55 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/kerberos/tool/kinit/KinitTool.java   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b8c8819a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
index a2c5a7a..bd634d8 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java
@@ -113,8 +113,10 @@ public class KinitTool {
             printUsage("Can't get the conf dir!");
         }
 
-        //If not request tickets by keytab than by password.
-        if (!ktOptions.contains(KinitOption.USE_KEYTAB)) {
+        if (ktOptions.contains(KinitOption.ANONYMOUS)) {
+            ktOptions.add(KrbOption.USE_PKINIT_ANONYMOUS);
+        } else if (!ktOptions.contains(KinitOption.USE_KEYTAB)) {
+            //If not request tickets by keytab than by password.
             ktOptions.add(KinitOption.USE_PASSWD);
             String password = getPassword(principal);
             ktOptions.add(KinitOption.USER_PASSWD, password);
@@ -166,6 +168,10 @@ public class KinitTool {
         return krbClient;
     }
 
+    private static String getAnonymousPrincipal() {
+        return "WELLKNOWN/ANONYMOUS";
+    }
+
     public static void main(String[] args) throws Exception {
         KOptions ktOptions = new KOptions();
         KinitOption kto;
@@ -207,7 +213,9 @@ public class KinitTool {
             ktOptions.add(kto);
         }
 
-        if (principal == null) {
+        if (principal == null && ktOptions.contains(KinitOption.ANONYMOUS)) {
+            principal = getAnonymousPrincipal();
+        } else {
             printUsage("No principal is specified");
         }
 


Mime
View raw message