directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject directory-kerby git commit: More PMD work
Date Mon, 27 Apr 2015 10:36:36 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master cf87fefc7 -> 2825f1e0d


More PMD work


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

Branch: refs/heads/master
Commit: 2825f1e0d8b0a6a1a45b30a1de2c82541342abde
Parents: cf87fef
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Apr 27 11:36:30 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Apr 27 11:36:30 2015 +0100

----------------------------------------------------------------------
 .../kerberos/kerb/client/InternalKrbClient.java | 11 +++++------
 .../kerby/kerberos/kerb/client/KrbHandler.java  |  2 --
 .../kerb/client/impl/DefaultKrbHandler.java     |  5 -----
 .../kerb/client/preauth/KrbPreauth.java         | 20 ++++++++++----------
 .../kerb/client/preauth/PreauthContext.java     |  7 ++-----
 .../kerb/client/preauth/PreauthHandler.java     | 18 +++++++-----------
 .../client/preauth/pkinit/PkinitPreauth.java    |  1 +
 .../kerb/client/request/ArmoredAsRequest.java   |  2 +-
 .../kerberos/kerb/client/request/AsRequest.java |  2 --
 .../kerb/client/request/KdcRequest.java         |  1 -
 10 files changed, 26 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/InternalKrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/InternalKrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/InternalKrbClient.java
index b772599..01a47c7 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/InternalKrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/InternalKrbClient.java
@@ -21,7 +21,6 @@ package org.apache.kerby.kerberos.kerb.client;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.KOptions;
-import org.apache.kerby.kerberos.kerb.client.KrbSetting;
 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.TgtTicket;
@@ -35,13 +34,13 @@ public interface InternalKrbClient {
      * Init with all the necessary options.
      * @param options
      */
-    public void init(KOptions options) throws KrbException;
+    void init(KOptions options) throws KrbException;
 
     /**
      * Get krb client settings.
      * @return setting
      */
-    public KrbSetting getSetting();
+    KrbSetting getSetting();
 
     /**
      * Request a Ticket Granting Ticket.
@@ -49,14 +48,14 @@ public interface InternalKrbClient {
      * @return a TGT
      * @throws KrbException
      */
-    public TgtTicket requestTgtTicket(KOptions requestOptions) throws KrbException;
+    TgtTicket requestTgtTicket(KOptions requestOptions) throws KrbException;
 
     /**
      * Request a service ticket using a TGT.
      * @return service ticket
      * @throws KrbException
      */
-    public ServiceTicket requestServiceTicketWithTgt(TgtTicket tgt,
+    ServiceTicket requestServiceTicketWithTgt(TgtTicket tgt,
                                               String serverPrincipal) throws KrbException;
 
     /**
@@ -64,6 +63,6 @@ public interface InternalKrbClient {
      * @return service ticket
      * @throws KrbException
      */
-    public ServiceTicket requestServiceTicketWithAccessToken(AuthToken token,
+    ServiceTicket requestServiceTicketWithAccessToken(AuthToken token,
                                               String serverPrincipal) throws KrbException;
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
index f65e855..abb56f1 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbHandler.java
@@ -33,11 +33,9 @@ import java.nio.ByteBuffer;
 
 public abstract class KrbHandler {
 
-    private KrbContext context;
     private PreauthHandler preauthHandler;
 
     public void init(KrbContext context) {
-        this.context = context;
         preauthHandler = new PreauthHandler();
         preauthHandler.init(context);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultKrbHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultKrbHandler.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultKrbHandler.java
index ee80372..f52763b 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultKrbHandler.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/DefaultKrbHandler.java
@@ -20,7 +20,6 @@
 package org.apache.kerby.kerberos.kerb.client.impl;
 
 import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.KrbContext;
 import org.apache.kerby.kerberos.kerb.client.KrbHandler;
 import org.apache.kerby.kerberos.kerb.client.request.KdcRequest;
 import org.apache.kerby.kerberos.kerb.transport.KrbTransport;
@@ -30,10 +29,6 @@ import java.nio.ByteBuffer;
 
 public class DefaultKrbHandler extends KrbHandler {
 
-    public void init(KrbContext context) {
-        super.init(context);
-    }
-
     @Override
     public void handleRequest(KdcRequest kdcRequest) throws KrbException {
         KrbTransport transport = (KrbTransport) kdcRequest.getSessionData();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/KrbPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/KrbPreauth.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/KrbPreauth.java
index 23bb7d8..5e00043 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/KrbPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/KrbPreauth.java
@@ -41,36 +41,36 @@ public interface KrbPreauth extends PreauthPluginMeta {
     /**
      * Initializing preauth plugin context
      */
-    public void init(KrbContext krbContext);
+    void init(KrbContext krbContext);
 
     /**
      * Initializing request context
      */
-    public PluginRequestContext initRequestContext(KdcRequest kdcRequest);
+    PluginRequestContext initRequestContext(KdcRequest kdcRequest);
 
     /**
      * Prepare questions to prompt to you asking for credential
      */
-    public void prepareQuestions(KdcRequest kdcRequest,
+    void prepareQuestions(KdcRequest kdcRequest,
                                  PluginRequestContext requestContext) throws KrbException;
 
     /**
      * Get supported encryption types
      */
-    public List<EncryptionType> getEncTypes(KdcRequest kdcRequest,
+    List<EncryptionType> getEncTypes(KdcRequest kdcRequest,
                                             PluginRequestContext requestContext);
 
     /**
      * Set krb options passed from user
      */
-    public void setPreauthOptions(KdcRequest kdcRequest,
+    void setPreauthOptions(KdcRequest kdcRequest,
                                   PluginRequestContext requestContext,
                                   KOptions preauthOptions);
 
     /**
      * Attempt to try any initial padata derived from user options
      */
-    public void tryFirst(KdcRequest kdcRequest,
+    void tryFirst(KdcRequest kdcRequest,
                          PluginRequestContext requestContext,
                          PaData outPadata) throws KrbException;
 
@@ -78,7 +78,7 @@ public interface KrbPreauth extends PreauthPluginMeta {
      * Process server returned paData and return back any result paData
      * Return true indicating padata is added
      */
-    public boolean process(KdcRequest kdcRequest,
+    boolean process(KdcRequest kdcRequest,
                            PluginRequestContext requestContext,
                            PaDataEntry inPadata,
                            PaData outPadata) throws KrbException;
@@ -87,7 +87,7 @@ public interface KrbPreauth extends PreauthPluginMeta {
      * When another request to server in the 4 pass, any paData to provide?
      * Return true indicating padata is added
      */
-    public boolean tryAgain(KdcRequest kdcRequest,
+    boolean tryAgain(KdcRequest kdcRequest,
                             PluginRequestContext requestContext,
                             PaDataType preauthType,
                             PaData errPadata,
@@ -97,11 +97,11 @@ public interface KrbPreauth extends PreauthPluginMeta {
      * Return PA_REAL if pa_type is a real preauthentication type or PA_INFO if it is
      * an informational type.
      */
-    public PaFlags getFlags(PaDataType paType);
+    PaFlags getFlags(PaDataType paType);
 
     /**
      * When exiting...
      */
-    public void destroy();
+    void destroy();
 
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthContext.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthContext.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthContext.java
index e622103..d71064d 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthContext.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthContext.java
@@ -32,13 +32,11 @@ public class PreauthContext {
     private PaData outputPaData;
     private PaData errorPaData;
     private UserResponser userResponser = new UserResponser();
-    private PaDataType selectedPaType;
     private PaDataType allowedPaType;
     private final List<PaDataType> triedPaTypes = new ArrayList<PaDataType>(1);
     private final List<PreauthHandle> handles = new ArrayList<PreauthHandle>(5);
 
     public PreauthContext() {
-        this.selectedPaType = PaDataType.NONE;
         this.allowedPaType = PaDataType.NONE;
         this.outputPaData = new PaData();
     }
@@ -56,8 +54,7 @@ public class PreauthContext {
     }
 
     public boolean isPaTypeAllowed(PaDataType paType) {
-        return (allowedPaType == PaDataType.NONE ||
-                allowedPaType == paType);
+        return allowedPaType == PaDataType.NONE || allowedPaType == paType;
     }
 
     public PaData getOutputPaData() throws KrbException {
@@ -65,7 +62,7 @@ public class PreauthContext {
     }
 
     public boolean hasInputPaData() {
-        return  (inputPaData != null && ! inputPaData.isEmpty());
+        return inputPaData != null && ! inputPaData.isEmpty();
     }
 
     public PaData getInputPaData() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthHandler.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthHandler.java
index 30599d6..81164cc 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthHandler.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/PreauthHandler.java
@@ -26,10 +26,7 @@ import org.apache.kerby.kerberos.kerb.client.preauth.builtin.TgtPreauth;
 import org.apache.kerby.kerberos.kerb.client.preauth.pkinit.PkinitPreauth;
 import org.apache.kerby.kerberos.kerb.client.preauth.token.TokenPreauth;
 import org.apache.kerby.kerberos.kerb.client.request.KdcRequest;
-import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.spec.base.EtypeInfo;
-import org.apache.kerby.kerberos.kerb.spec.base.EtypeInfo2;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaData;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaDataEntry;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaDataType;
@@ -93,7 +90,7 @@ public class PreauthHandler {
             return;
         }
 
-        attemptETypeInfo(kdcRequest, preauthContext.getInputPaData());
+        // attemptETypeInfo(kdcRequest, preauthContext.getInputPaData());
 
         setPreauthOptions(kdcRequest, kdcRequest.getPreauthOptions());
 
@@ -192,12 +189,11 @@ public class PreauthHandler {
 
         for (PaDataEntry pae : inPadata.getElements()) {
             PreauthHandle handle = findHandle(kdcRequest, pae.getPaDataType());
-            if (handle == null) {
-                continue;
-            }
-
-            boolean gotData = handle.tryAgain(kdcRequest,
+            if (handle != null) {
+                // boolean gotData = 
+                handle.tryAgain(kdcRequest,
                     pae.getPaDataType(), preauthContext.getErrorPaData(), outPadata);
+            }
         }
     }
 
@@ -221,10 +217,9 @@ public class PreauthHandler {
         return null;
     }
 
+    /*
     private void attemptETypeInfo(KdcRequest kdcRequest,
                                   PaData inPadata) throws KrbException {
-        PreauthContext preauthContext = kdcRequest.getPreauthContext();
-
         // Find an etype-info2 or etype-info element in padata
         EtypeInfo etypeInfo = null;
         EtypeInfo2 etypeInfo2 = null;
@@ -247,4 +242,5 @@ public class PreauthHandler {
                                   PaData inPadata) throws KrbException {
 
     }
+    */
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
index c616131..05eaf24 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
@@ -40,6 +40,7 @@ import org.apache.kerby.kerberos.kerb.spec.pa.PaDataType;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.*;
 import org.apache.kerby.kerberos.kerb.spec.x509.SubjectPublicKeyInfo;
 
+@SuppressWarnings("PMD")
 public class PkinitPreauth extends AbstractPreauthPlugin {
 
     private PkinitContext pkinitContext;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/ArmoredAsRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/ArmoredAsRequest.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/ArmoredAsRequest.java
index 5c45479..f0831ee 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/ArmoredAsRequest.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/ArmoredAsRequest.java
@@ -78,7 +78,7 @@ public abstract class ArmoredAsRequest extends AsRequest {
             throw new KrbException("Failed to load armor cache file");
         }
         EncryptionKey armorCacheKey =
-                cc.getCredentials().iterator().next().getKey();;
+                cc.getCredentials().iterator().next().getKey();
 
         return armorCacheKey;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequest.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequest.java
index f4a7226..47c09e3 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequest.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/AsRequest.java
@@ -22,7 +22,6 @@ package org.apache.kerby.kerberos.kerb.client.request;
 import org.apache.kerby.kerberos.kerb.KrbErrorCode;
 import org.apache.kerby.kerberos.kerb.ccache.CredentialCache;
 import org.apache.kerby.kerberos.kerb.client.KrbContext;
-import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.common.KrbUtil;
 import org.apache.kerby.kerberos.kerb.spec.base.*;
@@ -31,7 +30,6 @@ import org.apache.kerby.kerberos.kerb.spec.ticket.TgtTicket;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.List;
 
 public class AsRequest extends KdcRequest {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2825f1e0/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
index a7c6c3f..0abb5a4 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
@@ -63,7 +63,6 @@ public abstract class KdcRequest {
     private KrbFastContext fastContext;
     private EncryptionKey asKey;
 
-    private KrbError errorReply;
     private boolean isRetrying;
 
     public KdcRequest(KrbContext context) {


Mime
View raw message