directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject directory-kerby git commit: PKINIT. Use constant for the anonymous principal WELLKNOWN/ANONYMOUS
Date Fri, 25 Dec 2015 20:47:30 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master ce380f6b6 -> 675413088


PKINIT. Use constant for the anonymous principal WELLKNOWN/ANONYMOUS


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

Branch: refs/heads/master
Commit: 675413088144179d52486f6f8402132c1729d773
Parents: ce380f6
Author: Kai Zheng <kai.zheng@intel.com>
Authored: Sat Dec 26 04:47:15 2015 +0800
Committer: Kai Zheng <kai.zheng@intel.com>
Committed: Sat Dec 26 04:47:15 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java | 3 ++-
 .../apache/kerby/kerberos/kerb/client/KrbPkinitClient.java    | 4 +++-
 .../main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java | 1 +
 .../kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java    | 3 ++-
 .../java/org/apache/kerby/kerberos/tool/kinit/KinitTool.java  | 7 ++-----
 5 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67541308/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java
index 9e64fe8..7f1f5c2 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/AnonymousPkinitKdcTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.kerby.kerberos.kdc;
 
+import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
 import org.apache.kerby.kerberos.kerb.client.KrbPkinitClient;
@@ -57,7 +58,7 @@ public class AnonymousPkinitKdcTest extends KdcTestBase {
         super.createPrincipals();
         //Anonymity support is not enabled by default.
         //To enable it, you must create the principal WELLKNOWN/ANONYMOUS
-        getKdcServer().createPrincipal("WELLKNOWN/ANONYMOUS");
+        getKdcServer().createPrincipal(KrbConstant.ANONYMOUS_PRINCIPAL);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67541308/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbPkinitClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbPkinitClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbPkinitClient.java
index 4668583..fd361f7 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbPkinitClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbPkinitClient.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.client;
 
 import org.apache.kerby.KOptions;
+import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.type.ticket.TgtTicket;
 
@@ -89,7 +90,8 @@ public class KrbPkinitClient extends KrbClientBase {
     public TgtTicket requestTgt() throws KrbException {
         KOptions requestOptions = new KOptions();
         requestOptions.add(PkinitOption.USE_ANONYMOUS);
-        requestOptions.add(KrbOption.CLIENT_PRINCIPAL, "WELLKNOWN/ANONYMOUS");
+        requestOptions.add(KrbOption.CLIENT_PRINCIPAL,
+            KrbConstant.ANONYMOUS_PRINCIPAL);
         return requestTgt(requestOptions);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67541308/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java
index 7a97d1b..d9b4315 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbConstant.java
@@ -23,4 +23,5 @@ public class KrbConstant {
     public static final int KRB_V5 = 5;
 
     public static final String TGS_PRINCIPAL = "krbtgt";
+    public static final String ANONYMOUS_PRINCIPAL = "WELLKNOWN/ANONYMOUS";
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67541308/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
index ed8c058..a6c7733 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.codec;
 import org.apache.kerby.asn1.Asn1;
 import org.apache.kerby.cms.type.SignedContentInfo;
 import org.apache.kerby.cms.type.SignedData;
+import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.type.base.EncryptionType;
 import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
 import org.apache.kerby.kerberos.kerb.type.base.NameType;
@@ -84,7 +85,7 @@ public class TestPkinitAnonymousAsReqCodec {
         assertThat(body.getKdcOptions().getValue()).isEqualTo(Arrays.copyOfRange(bytes, 1389,
1393));
         PrincipalName cName = body.getCname();
         assertThat(cName.getNameType()).isEqualTo(NameType.NT_WELLKNOWN);
-        assertThat(cName.getName()).isEqualTo("WELLKNOWN/ANONYMOUS");
+        assertThat(cName.getName()).isEqualTo(KrbConstant.ANONYMOUS_PRINCIPAL);
         assertThat(body.getRealm()).isEqualTo("EXAMPLE.COM");
         PrincipalName sName = body.getSname();
         assertThat(sName.getNameType()).isEqualTo(NameType.NT_SRV_INST);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67541308/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 d59867a..7014960 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
@@ -24,6 +24,7 @@ import org.apache.kerby.KOptionGroup;
 import org.apache.kerby.KOptionInfo;
 import org.apache.kerby.KOptionType;
 import org.apache.kerby.KOptions;
+import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.client.KrbClient;
 import org.apache.kerby.kerberos.kerb.client.KrbKdcOption;
@@ -188,10 +189,6 @@ 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;
@@ -238,7 +235,7 @@ public class KinitTool {
 
         if (principal == null) {
             if (ktOptions.contains(KinitOption.ANONYMOUS)) {
-                principal = getAnonymousPrincipal();
+                principal = KrbConstant.ANONYMOUS_PRINCIPAL;
             } else {
                 printUsage("No principal is specified");
             }


Mime
View raw message