directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject directory-kerby git commit: Improving adding TGT principal in kerby kdc server.
Date Fri, 27 Mar 2015 05:12:32 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 4e4916b0d -> 6af11b6ce


Improving adding TGT principal in kerby kdc server.


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

Branch: refs/heads/master
Commit: 6af11b6cee5eb011bcf911375239bae3ef3538da
Parents: 4e4916b
Author: hazel <linchen7@foxmail.com>
Authored: Fri Mar 27 13:12:19 2015 +0800
Committer: hazel <linchen7@foxmail.com>
Committed: Fri Mar 27 13:12:19 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/kerberos/kdc/KerbyKdcServer.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/6af11b6c/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
index 3b903ff..f0d014b 100644
--- a/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
+++ b/kerby-kdc/src/main/java/org/apache/kerby/kerberos/kdc/KerbyKdcServer.java
@@ -64,7 +64,7 @@ public class KerbyKdcServer extends KdcServer {
             server.setConfDir(new File(confDir));
             server.init();
 
-            server.createPrincipals("krbtgt");
+            server.createTgtPrincipal();
 
             server.start();
             System.out.println("KDC started.");
@@ -76,7 +76,18 @@ public class KerbyKdcServer extends KdcServer {
         }
     }
 
-    //create some principal for test
+    /**
+     * Verify whether tgt identity has been added.
+     * If no, add it to identity backend.
+     */
+    private void createTgtPrincipal() {
+        String tgtPrincipal = "krbtgt";
+        KrbIdentity tgtIdentity = getIdentityService().getIdentity(tgtPrincipal);
+        if (tgtIdentity == null) {
+            createPrincipals(tgtPrincipal);
+        }
+    }
+
     private void createPrincipal(String principal, String password) {
         KrbIdentity identity = new KrbIdentity(fixPrincipal(principal));
         List<EncryptionType> encTypes = getKdcConfig().getEncryptionTypes();


Mime
View raw message