directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [06/19] directory-kerby git commit: DIRKRB-481 Refine some API functions favoring SGT (Service Granting Ticket)
Date Mon, 30 Nov 2015 03:09:47 GMT
DIRKRB-481 Refine some API functions favoring SGT (Service Granting Ticket)


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

Branch: refs/heads/pkinit-support
Commit: 5372621fa3a2ba2233a0a01d05d39c07d8595d13
Parents: d10bf63
Author: Kai Zheng <kai.zheng@intel.com>
Authored: Sun Nov 29 07:34:14 2015 +0800
Committer: Kai Zheng <kai.zheng@intel.com>
Committed: Sun Nov 29 07:34:14 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/kerberos/kdc/KerbyKdcTest.java | 10 +++----
 .../kerberos/kdc/WithAccessTokenKdcTest.java    |  6 ++--
 .../kerberos/kdc/WithIdentityTokenKdcTest.java  |  6 ++--
 .../kerberos/kdc/WithTokenKdcTestBase.java      |  2 +-
 .../integration/test/TokenLoginTestBase.java    |  4 +--
 .../kerby/kerberos/kerb/client/KrbClient.java   | 30 +++++++++----------
 .../kerberos/kerb/client/KrbPkinitClient.java   |  4 +--
 .../kerberos/kerb/client/KrbTokenClient.java    |  8 ++---
 .../client/impl/AbstractInternalKrbClient.java  |  8 ++---
 .../client/impl/DefaultInternalKrbClient.java   |  4 +--
 .../kerb/client/impl/InternalKrbClient.java     |  6 ++--
 .../kerb/client/request/TgsRequest.java         |  6 ++--
 .../kerb/spec/ticket/ServiceTicket.java         | 28 ------------------
 .../kerberos/kerb/spec/ticket/SgtTicket.java    | 31 ++++++++++++++++++++
 .../kerberos/kerb/spec/ticket/TgtTicket.java    |  3 ++
 .../kerby/kerberos/kerb/server/KdcTest.java     | 10 +++----
 .../kerberos/kerb/server/LoginTestBase.java     |  2 +-
 .../kerb/server/MultiRequestsKdcTest.java       | 14 ++++-----
 .../kerby/kerberos/tool/kinit/KinitTool.java    | 12 ++++----
 19 files changed, 99 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/KerbyKdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/KerbyKdcTest.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/KerbyKdcTest.java
index f782719..d601838 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/KerbyKdcTest.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/KerbyKdcTest.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.kdc;
 import org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.server.KdcTestBase;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.junit.Assert;
 
@@ -39,14 +39,14 @@ public abstract class KerbyKdcTest extends KdcTestBase {
 
     protected void performKdcTest() throws Exception {
         TgtTicket tgt;
-        ServiceTicket tkt;
+        SgtTicket tkt;
 
         try {
-            tgt = getKrbClient().requestTgtWithPassword(
-                    getClientPrincipal(), getClientPassword());
+            tgt = getKrbClient().requestTgt(
+                getClientPrincipal(), getClientPassword());
             assertThat(tgt).isNotNull();
 
-            tkt = getKrbClient().requestServiceTicketWithTgt(tgt, getServerPrincipal());
+            tkt = getKrbClient().requestSgt(tgt, getServerPrincipal());
             assertThat(tkt).isNotNull();
         } catch (Exception e) {
             System.out.println("Exception occurred with good password");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithAccessTokenKdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithAccessTokenKdcTest.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithAccessTokenKdcTest.java
index 2643de6..27eeac4 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithAccessTokenKdcTest.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithAccessTokenKdcTest.java
@@ -30,7 +30,7 @@ import org.apache.kerby.kerberos.kerb.client.KrbTokenClient;
 import org.apache.kerby.kerberos.kerb.common.PrivateKeyReader;
 import org.apache.kerby.kerberos.kerb.common.PublicKeyReader;
 import org.apache.kerby.kerberos.kerb.server.TestKdcServer;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -138,9 +138,9 @@ public class WithAccessTokenKdcTest extends WithTokenKdcTestBase {
 
         KrbTokenClient tokenClient = new KrbTokenClient(getKrbClient());
         try {
-            ServiceTicket serviceTicket = tokenClient.requestServiceTicket(
+            SgtTicket sgtTicket = tokenClient.requestSgt(
                 getKrbToken(), getServerPrincipal(), getcCacheFile().getPath());
-            verifyTicket(serviceTicket);
+            verifyTicket(sgtTicket);
         } finally {
             deleteCcacheFile();
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithIdentityTokenKdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithIdentityTokenKdcTest.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithIdentityTokenKdcTest.java
index 0e4722c..eeb3938 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithIdentityTokenKdcTest.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithIdentityTokenKdcTest.java
@@ -24,7 +24,7 @@ import org.apache.kerby.kerberos.kerb.client.KrbTokenClient;
 import org.apache.kerby.kerberos.kerb.common.PrivateKeyReader;
 import org.apache.kerby.kerberos.kerb.common.PublicKeyReader;
 import org.apache.kerby.kerberos.kerb.server.TestKdcServer;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.junit.Assert;
 import org.junit.Test;
@@ -149,8 +149,8 @@ public class WithIdentityTokenKdcTest extends WithTokenKdcTestBase {
         }
         verifyTicket(tgt);
 
-        ServiceTicket tkt = getKrbClient().requestServiceTicketWithTgt(tgt,
-                getServerPrincipal());
+        SgtTicket tkt = getKrbClient().requestSgt(tgt,
+            getServerPrincipal());
         verifyTicket(tkt);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithTokenKdcTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithTokenKdcTestBase.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithTokenKdcTestBase.java
index e90e8c5..322a387 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithTokenKdcTestBase.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/WithTokenKdcTestBase.java
@@ -142,7 +142,7 @@ public class WithTokenKdcTestBase extends KdcTestBase {
 
     protected File createCredentialCache(String principal,
                                        String password) throws Exception {
-        TgtTicket tgt = getKrbClient().requestTgtWithPassword(principal, password);
+        TgtTicket tgt = getKrbClient().requestTgt(principal, password);
         writeTgtToCache(tgt, principal);
         return cCacheFile;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TokenLoginTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TokenLoginTestBase.java
b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TokenLoginTestBase.java
index 4fcc54d..1674e2a 100644
--- a/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TokenLoginTestBase.java
+++ b/kerby-kerb/integration-test/src/test/java/org/apache/kerby/kerberos/kerb/integration/test/TokenLoginTestBase.java
@@ -89,8 +89,8 @@ public class TokenLoginTestBase extends LoginTestBase {
         System.out.println("Issued token: " + tokenStr);
         tokenCache = TokenCache.getDefaultTokenCache();
 
-        TgtTicket tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(),
-                getClientPassword());
+        TgtTicket tgt = getKrbClient().requestTgt(getClientPrincipal(),
+            getClientPassword());
         getKrbClient().storeTicket(tgt, armorCache);
 
         return tokenStr;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
index 7053286..b828f92 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
@@ -24,15 +24,13 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.ccache.CredentialCache;
 import org.apache.kerby.kerberos.kerb.client.impl.DefaultInternalKrbClient;
 import org.apache.kerby.kerberos.kerb.client.impl.InternalKrbClient;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
-import java.security.PrivateKey;
-import java.security.cert.Certificate;
 
 /**
  * A Krb client API for applications to interact with KDC
@@ -168,13 +166,13 @@ public class KrbClient {
      * @return The tgt ticket
      * @throws KrbException e
      */
-    public TgtTicket requestTgtWithPassword(String principal,
-                                      String password) throws KrbException {
+    public TgtTicket requestTgt(String principal,
+                                String password) throws KrbException {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.CLIENT_PRINCIPAL, principal);
         requestOptions.add(KrbOption.USE_PASSWD, true);
         requestOptions.add(KrbOption.USER_PASSWD, password);
-        return requestTgtWithOptions(requestOptions);
+        return requestTgt(requestOptions);
     }
 
     /**
@@ -184,13 +182,13 @@ public class KrbClient {
      * @return TGT
      * @throws KrbException e
      */
-    public TgtTicket requestTgtWithKeytab(String principal,
-                                      File keytabFile) throws KrbException {
+    public TgtTicket requestTgt(String principal,
+                                File keytabFile) throws KrbException {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.CLIENT_PRINCIPAL, principal);
         requestOptions.add(KrbOption.USE_KEYTAB, true);
         requestOptions.add(KrbOption.KEYTAB_FILE, keytabFile);
-        return requestTgtWithOptions(requestOptions);
+        return requestTgt(requestOptions);
     }
 
     /**
@@ -199,12 +197,12 @@ public class KrbClient {
      * @return TGT
      * @throws KrbException e
      */
-    public TgtTicket requestTgtWithOptions(KOptions requestOptions) throws KrbException {
+    public TgtTicket requestTgt(KOptions requestOptions) throws KrbException {
         if (requestOptions == null) {
             throw new IllegalArgumentException("Null requestOptions specified");
         }
 
-        return innerClient.requestTgtTicket(requestOptions);
+        return innerClient.requestTgt(requestOptions);
     }
 
     /**
@@ -214,12 +212,12 @@ public class KrbClient {
      * @return Service ticket
      * @throws KrbException e
      */
-    public ServiceTicket requestServiceTicketWithTgt(
-            TgtTicket tgt, String serverPrincipal) throws KrbException {
+    public SgtTicket requestSgt(TgtTicket tgt,
+                                String serverPrincipal) throws KrbException {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.USE_TGT, tgt);
         requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal);
-        return innerClient.requestServiceTicket(requestOptions);
+        return innerClient.requestSgt(requestOptions);
     }
 
     /**
@@ -228,8 +226,8 @@ public class KrbClient {
      * @return service ticket
      * @throws KrbException e
      */
-    public ServiceTicket requestServiceTicket(KOptions requestOptions) throws KrbException
{
-        return innerClient.requestServiceTicket(requestOptions);
+    public SgtTicket requestSgt(KOptions requestOptions) throws KrbException {
+        return innerClient.requestSgt(requestOptions);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/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 09ac113..7f302fd 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
@@ -60,7 +60,7 @@ public class KrbPkinitClient {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.PKINIT_X509_CERTIFICATE, certificate);
         requestOptions.add(KrbOption.PKINIT_X509_PRIVATE_KEY, privateKey);
-        return krbClient.requestTgtWithOptions(requestOptions);
+        return krbClient.requestTgt(requestOptions);
     }
 
     /**
@@ -71,6 +71,6 @@ public class KrbPkinitClient {
     public TgtTicket requestTgt() throws KrbException {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.USE_PKINIT_ANONYMOUS);
-        return krbClient.requestTgtWithOptions(requestOptions);
+        return krbClient.requestTgt(requestOptions);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbTokenClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbTokenClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbTokenClient.java
index 55fe727..66d8d75 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbTokenClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbTokenClient.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.kerb.client;
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.spec.base.AuthToken;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 
 /**
@@ -62,7 +62,7 @@ public class KrbTokenClient {
         KOptions requestOptions = new KOptions();
         requestOptions.add(KrbOption.TOKEN_USER_ID_TOKEN, token);
         requestOptions.add(KrbOption.ARMOR_CACHE, armorCache);
-        return krbClient.requestTgtWithOptions(requestOptions);
+        return krbClient.requestTgt(requestOptions);
     }
 
     /**
@@ -73,7 +73,7 @@ public class KrbTokenClient {
      * @return service ticket
      * @throws KrbException e
      */
-    public ServiceTicket requestServiceTicket(
+    public SgtTicket requestSgt(
         AuthToken token, String serverPrincipal, String armorCache) throws KrbException {
         if (!token.isAcToken()) {
             throw new IllegalArgumentException("Access token is expected");
@@ -84,6 +84,6 @@ public class KrbTokenClient {
         requestOptions.add(KrbOption.ARMOR_CACHE, armorCache);
         requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal);
 
-        return krbClient.requestServiceTicket(requestOptions);
+        return krbClient.requestSgt(requestOptions);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/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..9555a8b 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,7 +35,7 @@ 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.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 
 /**
@@ -74,7 +74,7 @@ public abstract class AbstractInternalKrbClient implements InternalKrbClient
{
      * {@inheritDoc}
      */
     @Override
-    public TgtTicket requestTgtTicket(KOptions requestOptions) throws KrbException {
+    public TgtTicket requestTgt(KOptions requestOptions) throws KrbException {
         AsRequest asRequest = null;
 
         if (requestOptions.contains(KrbOption.USE_PASSWD)) {
@@ -117,7 +117,7 @@ public abstract class AbstractInternalKrbClient implements InternalKrbClient
{
      * {@inheritDoc}
      */
     @Override
-    public ServiceTicket requestServiceTicket(KOptions requestOptions) throws KrbException
{
+    public SgtTicket requestSgt(KOptions requestOptions) throws KrbException {
         TgsRequest tgsRequest = null;
         if (requestOptions.contains(KrbOption.TOKEN_USER_AC_TOKEN)) {
             tgsRequest = new TgsRequestWithToken(context);
@@ -142,7 +142,7 @@ public abstract class AbstractInternalKrbClient implements InternalKrbClient
{
     protected abstract TgtTicket doRequestTgtTicket(
             AsRequest tgtTktReq) throws KrbException;
 
-    protected abstract ServiceTicket doRequestServiceTicket(
+    protected abstract SgtTicket doRequestServiceTicket(
             TgsRequest tgsRequest) throws KrbException;
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultInternalKrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultInternalKrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultInternalKrbClient.java
index 87d9e71..b8a7775 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultInternalKrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultInternalKrbClient.java
@@ -24,7 +24,7 @@ import org.apache.kerby.kerberos.kerb.client.ClientUtil;
 import org.apache.kerby.kerberos.kerb.client.KrbSetting;
 import org.apache.kerby.kerberos.kerb.client.request.AsRequest;
 import org.apache.kerby.kerberos.kerb.client.request.TgsRequest;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.apache.kerby.kerberos.kerb.transport.KrbNetwork;
 import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
@@ -80,7 +80,7 @@ public class DefaultInternalKrbClient extends AbstractInternalKrbClient
{
      * {@inheritDoc}
      */
     @Override
-    protected ServiceTicket doRequestServiceTicket(TgsRequest ticketReq) throws KrbException
{
+    protected SgtTicket doRequestServiceTicket(TgsRequest ticketReq) throws KrbException
{
         ticketReq.setSessionData(transport);
 
         krbHandler.handleRequest(ticketReq);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/InternalKrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/InternalKrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/InternalKrbClient.java
index 9373a1d..68534fb 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/InternalKrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/InternalKrbClient.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.kerb.client.impl;
 import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.client.KrbSetting;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 
 /**
@@ -48,7 +48,7 @@ public interface InternalKrbClient {
      * @return a TGT
      * @throws KrbException e
      */
-    TgtTicket requestTgtTicket(KOptions requestOptions) throws KrbException;
+    TgtTicket requestTgt(KOptions requestOptions) throws KrbException;
 
     /**
      * Request a service ticket provided request options
@@ -56,5 +56,5 @@ public interface InternalKrbClient {
      * @return service ticket
      * @throws KrbException e
      */
-    ServiceTicket requestServiceTicket(KOptions requestOptions) throws KrbException;
+    SgtTicket requestSgt(KOptions requestOptions) throws KrbException;
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/TgsRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/TgsRequest.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/TgsRequest.java
index 033e027..5a813e9 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/TgsRequest.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/TgsRequest.java
@@ -31,7 +31,7 @@ import org.apache.kerby.kerberos.kerb.spec.kdc.KdcRep;
 import org.apache.kerby.kerberos.kerb.spec.kdc.KdcReqBody;
 import org.apache.kerby.kerberos.kerb.spec.kdc.TgsRep;
 import org.apache.kerby.kerberos.kerb.spec.kdc.TgsReq;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,8 +91,8 @@ public class TgsRequest extends KdcRequest {
         }
     }
 
-    public ServiceTicket getServiceTicket() {
-        ServiceTicket serviceTkt = new ServiceTicket(getKdcRep().getTicket(),
+    public SgtTicket getServiceTicket() {
+        SgtTicket serviceTkt = new SgtTicket(getKdcRep().getTicket(),
                 (EncTgsRepPart) getKdcRep().getEncPart());
         return serviceTkt;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/ServiceTicket.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/ServiceTicket.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/ServiceTicket.java
deleted file mode 100644
index 0c119fa..0000000
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/ServiceTicket.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.kerby.kerberos.kerb.spec.ticket;
-
-import org.apache.kerby.kerberos.kerb.spec.kdc.EncTgsRepPart;
-
-public class ServiceTicket extends KrbTicket {
-    public ServiceTicket(Ticket ticket, EncTgsRepPart encKdcRepPart) {
-        super(ticket, encKdcRepPart);
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/SgtTicket.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/SgtTicket.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/SgtTicket.java
new file mode 100644
index 0000000..04068c6
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/SgtTicket.java
@@ -0,0 +1,31 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.kerby.kerberos.kerb.spec.ticket;
+
+import org.apache.kerby.kerberos.kerb.spec.kdc.EncTgsRepPart;
+
+/**
+ * Service granting ticket.
+ */
+public class SgtTicket extends KrbTicket {
+    public SgtTicket(Ticket ticket, EncTgsRepPart encKdcRepPart) {
+        super(ticket, encKdcRepPart);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TgtTicket.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TgtTicket.java
b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TgtTicket.java
index 0a119aa..23df8d9 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TgtTicket.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TgtTicket.java
@@ -22,6 +22,9 @@ package org.apache.kerby.kerberos.kerb.spec.ticket;
 import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.kdc.EncAsRepPart;
 
+/**
+ * Ticket granting ticket.
+ */
 public class TgtTicket extends KrbTicket {
     private PrincipalName clientPrincipal;
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTest.java
b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTest.java
index 5fcc9fd..6ebe00a 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTest.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/KdcTest.java
@@ -19,7 +19,7 @@
  */
 package org.apache.kerby.kerberos.kerb.server;
 
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.junit.Assert;
 
@@ -29,14 +29,14 @@ public abstract class KdcTest extends KdcTestBase {
 
     protected void performKdcTest() throws Exception {
         TgtTicket tgt;
-        ServiceTicket tkt;
+        SgtTicket tkt;
 
         try {
-            tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(),
-                    getClientPassword());
+            tgt = getKrbClient().requestTgt(getClientPrincipal(),
+                getClientPassword());
             assertThat(tgt).isNotNull();
 
-            tkt = getKrbClient().requestServiceTicketWithTgt(tgt, getServerPrincipal());
+            tkt = getKrbClient().requestSgt(tgt, getServerPrincipal());
             assertThat(tkt).isNotNull();
         } catch (Exception e) {
             System.out.println("Exception occurred with good password");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
index 18628ad..88ba06e 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
@@ -53,7 +53,7 @@ public class LoginTestBase extends KdcTestBase {
     }
 
     protected Subject loginClientUsingTicketCache() throws Exception {
-        TgtTicket tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(),
+        TgtTicket tgt = getKrbClient().requestTgt(getClientPrincipal(),
             getClientPassword());
         getKrbClient().storeTicket(tgt, ticketCacheFile);
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/MultiRequestsKdcTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/MultiRequestsKdcTest.java
b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/MultiRequestsKdcTest.java
index 61a560b..55f9c99 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/MultiRequestsKdcTest.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/MultiRequestsKdcTest.java
@@ -19,7 +19,7 @@
  */
 package org.apache.kerby.kerberos.kerb.server;
 
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.junit.Assert;
 import org.junit.Test;
@@ -32,15 +32,15 @@ public class MultiRequestsKdcTest extends KdcTestBase {
     @Test
     public void multiRequestsTest() throws Exception {
         TgtTicket tgt;
-        ServiceTicket tkt;
+        SgtTicket tkt;
 
         // With good password
         try {
-            tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(), getClientPassword());
+            tgt = getKrbClient().requestTgt(getClientPrincipal(), getClientPassword());
             assertThat(tgt).isNotNull();
 
             serverPrincipal = getServerPrincipal();
-            tkt = getKrbClient().requestServiceTicketWithTgt(tgt, serverPrincipal);
+            tkt = getKrbClient().requestSgt(tgt, serverPrincipal);
             assertThat(tkt).isNotNull();
         } catch (Exception e) {
             System.out.println("Exception occurred with good password");
@@ -51,17 +51,17 @@ public class MultiRequestsKdcTest extends KdcTestBase {
         // With bad password
         /*
         try {
-            tgt = krbClnt.requestTgtWithPassword(clientPrincipal, "badpassword");
+            tgt = krbClnt.requestTgt(clientPrincipal, "badpassword");
         } catch (Exception e) {
             System.out.println("Exception occurred with bad password");
         }*/
 
         // With good password again
         try {
-            tgt = getKrbClient().requestTgtWithPassword(getClientPrincipal(), getClientPassword());
+            tgt = getKrbClient().requestTgt(getClientPrincipal(), getClientPassword());
             assertThat(tgt).isNotNull();
 
-            tkt = getKrbClient().requestServiceTicketWithTgt(tgt, serverPrincipal);
+            tkt = getKrbClient().requestSgt(tgt, serverPrincipal);
             assertThat(tkt).isNotNull();
         } catch (Exception e) {
             System.out.println("Exception occurred with good password again");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5372621f/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 a7329c4..cb4c55f 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,7 +24,7 @@ import org.apache.kerby.KOptions;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.client.KrbClient;
 import org.apache.kerby.kerberos.kerb.client.KrbOption;
-import org.apache.kerby.kerberos.kerb.spec.ticket.ServiceTicket;
+import org.apache.kerby.kerberos.kerb.spec.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 import org.apache.kerby.kerberos.tool.ToolUtil;
 import org.apache.kerby.util.OSUtil;
@@ -129,8 +129,8 @@ public class KinitTool {
 
         TgtTicket tgt = null;
         try {
-            tgt = krbClient.requestTgtWithOptions(
-                    ToolUtil.convertOptions(ktOptions));
+            tgt = krbClient.requestTgt(
+                ToolUtil.convertOptions(ktOptions));
         } catch (KrbException e) {
             System.err.println("Authentication failed: " + e.getMessage());
             System.exit(1);
@@ -157,10 +157,10 @@ public class KinitTool {
                 + ccacheFile.getAbsolutePath());
         if (ktOptions.contains(KinitOption.SERVICE)) {
             String servicePrincipal = ktOptions.getStringOption(KinitOption.SERVICE);
-            ServiceTicket serviceTicket =
-                    krbClient.requestServiceTicketWithTgt(tgt, servicePrincipal);
+            SgtTicket sgtTicket =
+                    krbClient.requestSgt(tgt, servicePrincipal);
             System.out.println("Successfully requested the service ticket for " + servicePrincipal
-            + "\nKey version: " + serviceTicket.getTicket().getTktvno());
+            + "\nKey version: " + sgtTicket.getTicket().getTktvno());
         }
     }
 


Mime
View raw message