directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [1/2] directory-kerby git commit: DIRKRB-644 - ClassCastException in TokenPreauth
Date Tue, 05 Sep 2017 02:02:06 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/cross-realm 06acee13d -> c4c43ced6


DIRKRB-644 - ClassCastException in TokenPreauth


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

Branch: refs/heads/cross-realm
Commit: ea9f606702465390f2362f6d099253c42472ed17
Parents: 06acee1
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Aug 10 10:11:22 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Aug 10 10:11:22 2017 +0100

----------------------------------------------------------------------
 .../apache/kerby/kerberos/kdc/TokenKdcTestBase.java |  8 ++++----
 .../kerby/kerberos/kerb/client/KrbTokenClient.java  | 16 ++++++++--------
 .../kerb/client/preauth/token/TokenPreauth.java     | 14 +++++++-------
 3 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ea9f6067/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/TokenKdcTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/TokenKdcTestBase.java
b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/TokenKdcTestBase.java
index 6767e47..b53495a 100644
--- a/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/TokenKdcTestBase.java
+++ b/kerby-kdc-test/src/test/java/org/apache/kerby/kerberos/kdc/TokenKdcTestBase.java
@@ -67,27 +67,27 @@ public class TokenKdcTestBase extends KdcTestBase {
         super.configKdcSeverAndClient();
         String verifyKeyPath = this.getClass().getResource("/").getPath();
         getKdcServer().getKdcConfig().setString(KdcConfigKey.TOKEN_VERIFY_KEYS, verifyKeyPath);
-        
+
         URL privateKeyPath = TokenKdcTestBase.class.getResource("/private_key.pem");
         getKdcServer().getKdcConfig().setString(KdcConfigKey.TOKEN_DECRYPTION_KEYS, privateKeyPath.getPath());
         getKdcServer().getKdcConfig().setString(KdcConfigKey.TOKEN_ISSUERS, ISSUER);
     }
 
-    protected AuthToken getKrbToken() {
+    protected KrbToken getKrbToken() {
         return krbToken;
     }
 
     protected File getcCacheFile() {
         return cCacheFile;
     }
-    
+
     protected AuthToken prepareToken(String audience) throws Exception {
         InputStream is = TokenKdcTestBase.class.getResourceAsStream("/private_key.pem");
         PrivateKey privateKey = PrivateKeyReader.loadPrivateKey(is);
 
         return prepareToken(audience, ISSUER, privateKey, null);
     }
-    
+
     protected AuthToken prepareToken(String audience, String issuer,
                                      PrivateKey signingKey, PublicKey encryptionKey) {
         AuthToken authToken = KrbRuntime.getTokenProvider().createTokenFactory().createToken();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ea9f6067/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 eedc016..c71e987 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
@@ -21,7 +21,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.type.base.AuthToken;
+import org.apache.kerby.kerberos.kerb.type.base.KrbToken;
 import org.apache.kerby.kerberos.kerb.type.ticket.SgtTicket;
 import org.apache.kerby.kerberos.kerb.type.ticket.TgtTicket;
 
@@ -67,12 +67,12 @@ public class KrbTokenClient extends KrbClientBase {
 
     /**
      * Request a TGT with user token credential and armor cache
-     * @param token The auth token
+     * @param token The KrbToken
      * @param armorCache The armor cache
      * @return TGT
      * @throws KrbException e
      */
-    public TgtTicket requestTgt(AuthToken token, String armorCache) throws KrbException {
+    public TgtTicket requestTgt(KrbToken token, String armorCache) throws KrbException {
         if (!token.isIdToken()) {
             throw new IllegalArgumentException("Identity token is expected");
         }
@@ -85,12 +85,12 @@ public class KrbTokenClient extends KrbClientBase {
 
     /**
      * Request a TGT with user token credential and tgt
-     * @param token The auth token
+     * @param token The KrbToken
      * @param tgt The tgt ticket
      * @return TGT
      * @throws KrbException e
      */
-    public TgtTicket requestTgt(AuthToken token, TgtTicket tgt) throws KrbException {
+    public TgtTicket requestTgt(KrbToken token, TgtTicket tgt) throws KrbException {
         if (!token.isIdToken()) {
             throw new IllegalArgumentException("Identity token is expected");
         }
@@ -103,14 +103,14 @@ public class KrbTokenClient extends KrbClientBase {
 
     /**
      * Request a service ticket using an Access Token.
-     * @param token The auth token
+     * @param token The KrbToken
      * @param serverPrincipal The server principal
      * @param armorCache The armor cache
      * @return service ticket
      * @throws KrbException e
      */
     public SgtTicket requestSgt(
-        AuthToken token, String serverPrincipal, String armorCache) throws KrbException {
+        KrbToken token, String serverPrincipal, String armorCache) throws KrbException {
         if (!token.isAcToken()) {
             throw new IllegalArgumentException("Access token is expected");
         }
@@ -123,7 +123,7 @@ public class KrbTokenClient extends KrbClientBase {
         return requestSgt(requestOptions);
     }
 
-    public SgtTicket requestSgt(AuthToken token, String serverPrincipal, TgtTicket tgt) throws
KrbException {
+    public SgtTicket requestSgt(KrbToken token, String serverPrincipal, TgtTicket tgt) throws
KrbException {
         if (!token.isAcToken()) {
             throw new IllegalArgumentException("Access token is expected");
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ea9f6067/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/token/TokenPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/token/TokenPreauth.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/token/TokenPreauth.java
index 0830f20..20bac36 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/token/TokenPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/token/TokenPreauth.java
@@ -14,7 +14,7 @@
  *  "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. 
+ *  under the License.
  *
  */
 package org.apache.kerby.kerberos.kerb.client.preauth.token;
@@ -36,7 +36,7 @@ import org.apache.kerby.kerberos.kerb.type.base.AuthToken;
 import org.apache.kerby.kerberos.kerb.type.base.EncryptedData;
 import org.apache.kerby.kerberos.kerb.type.base.EncryptionType;
 import org.apache.kerby.kerberos.kerb.type.base.KeyUsage;
-import org.apache.kerby.kerberos.kerb.type.base.KrbTokenBase;
+import org.apache.kerby.kerberos.kerb.type.base.KrbToken;
 import org.apache.kerby.kerberos.kerb.type.pa.PaData;
 import org.apache.kerby.kerberos.kerb.type.pa.PaDataEntry;
 import org.apache.kerby.kerberos.kerb.type.pa.PaDataType;
@@ -177,19 +177,19 @@ public class TokenPreauth extends AbstractPreauthPlugin {
 
         KOption idToken = options.getOption(TokenOption.USER_ID_TOKEN);
         KOption acToken = options.getOption(TokenOption.USER_AC_TOKEN);
-        AuthToken authToken;
+        KrbToken krbToken;
         if (idToken != null) {
-            authToken = (AuthToken) idToken.getOptionInfo().getValue();
+            krbToken = (KrbToken) idToken.getOptionInfo().getValue();
         } else if (acToken != null) {
-            authToken = (AuthToken) acToken.getOptionInfo().getValue();
+            krbToken = (KrbToken) acToken.getOptionInfo().getValue();
         } else {
             throw new KrbException("missing token.");
         }
 
         PaTokenRequest tokenPa = new PaTokenRequest();
-        tokenPa.setToken((KrbTokenBase) authToken);
+        tokenPa.setToken(krbToken);
         TokenInfo info = new TokenInfo();
-        info.setTokenVendor(authToken.getIssuer());
+        info.setTokenVendor(krbToken.getIssuer());
         tokenPa.setTokenInfo(info);
 
         EncryptedData paDataValue = EncryptionUtil.seal(tokenPa,


Mime
View raw message