You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/08/24 06:38:01 UTC

svn commit: r239526 - in /directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store: ./ operations/

Author: erodriguez
Date: Tue Aug 23 21:37:55 2005
New Revision: 239526

URL: http://svn.apache.org/viewcvs?rev=239526&view=rev
Log:
Reformatting:  imports, whitespace, line breaks, or code convention.

Modified:
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/ContextOperation.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/JndiPrincipalStoreImpl.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/KerberosAttribute.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStore.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/ChangePassword.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/ContextOperation.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/ContextOperation.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/ContextOperation.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/ContextOperation.java Tue Aug 23 21:37:55 2005
@@ -16,13 +16,11 @@
  */
 package org.apache.kerberos.store;
 
-
 import java.io.Serializable;
 
 import javax.naming.Name;
 import javax.naming.directory.DirContext;
 
-
 /**
  * Doc me.
  *
@@ -41,4 +39,3 @@
      */
     public Object execute( DirContext ctx, Name searchBaseDn ) throws Exception;
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/JndiPrincipalStoreImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/JndiPrincipalStoreImpl.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/JndiPrincipalStoreImpl.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/JndiPrincipalStoreImpl.java Tue Aug 23 21:37:55 2005
@@ -16,11 +16,9 @@
  */
 package org.apache.kerberos.store;
 
-
 import javax.naming.Name;
 import javax.naming.ldap.LdapContext;
 
-
 /**
  * A simple implementation of the PrincipalStore interface using a JNDI
  * based store.
@@ -36,7 +34,6 @@
     /** the search searchBase relative to the DN of the context supplied */
     private Name searchBase;
 
-
     /**
      * Creates the action to be used against the embedded ApacheDS DIT.  Note
      * the searchBase is a relative name to the context and not a DN.
@@ -51,13 +48,11 @@
         this.searchBase = searchBase;
     }
 
-
     public Object execute( ContextOperation operation ) throws Exception
     {
         return operation.execute( ctx, searchBase );
     }
 
-
     /**
      * Gets the LdapContext used to search for principals in the JNDI store.
      *
@@ -68,7 +63,6 @@
         return ctx;
     }
 
-
     /**
      * Gets the search base use for finding principals in the the store.
      *
@@ -79,4 +73,3 @@
         return searchBase;
     }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/KerberosAttribute.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/KerberosAttribute.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/KerberosAttribute.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/KerberosAttribute.java Tue Aug 23 21:37:55 2005
@@ -14,16 +14,14 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.store;
 
-
 public class KerberosAttribute
 {
     // ------------------------------------------------------------------------
     // Krb5 Schema Attributes
     // ------------------------------------------------------------------------
-    
+
     /** the krb5kdc schema key for a krb5KDCEntry */
     public static final String KEY       = "krb5Key";
     /** the krb5kdc schema key encryption type for a krb5KDCEntry */
@@ -33,6 +31,5 @@
     /** the krb5kdc schema key version identifier for a krb5KDCEntry */
     public static final String VERSION   = "krb5KeyVersionNumber";
     /** the Apache specific SAM type attribute */
-    public static final String SAM_TYPE   = "apacheSamType";
+    public static final String SAM_TYPE  = "apacheSamType";
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStore.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStore.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStore.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStore.java Tue Aug 23 21:37:55 2005
@@ -14,12 +14,9 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.store;
 
-
 public interface PrincipalStore
 {
     public Object execute( ContextOperation operation ) throws Exception;
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java Tue Aug 23 21:37:55 2005
@@ -23,78 +23,94 @@
 import org.apache.kerberos.messages.value.KerberosTime;
 import org.apache.kerberos.messages.value.SamType;
 
-public class PrincipalStoreEntry {
-	
+public class PrincipalStoreEntry
+{
 	// 'Principal'
-	private String            _commonName;
-	private KerberosPrincipal _principal;
-	
+	private String            commonName;
+	private KerberosPrincipal principal;
+
 	// 'KDCEntry'
-	private KerberosTime  _validStart;
-	private KerberosTime  _validEnd;
-	private KerberosTime  _passwordEnd;
-	private int           _maxLife;
-	private int           _maxRenew;
-	private int           _kdcFlags;
-    private SamType samType = null;
-	private EncryptionKey _key;
-	
-	private String _realmName;
-	
-	PrincipalStoreEntry(String commonName, KerberosPrincipal principal,
-			int keyVersionNumber, KerberosTime validStart, KerberosTime validEnd,
-			KerberosTime passwordEnd, int maxLife, int maxRenew, int kdcFlags,
-			int keyType, byte[] key, String realmName, SamType samType) {
-		
-		_commonName       = commonName;
-		_principal        = principal;
-		_validStart       = validStart;
-		_validEnd         = validEnd;
-		_passwordEnd      = passwordEnd;
-		_maxLife          = maxLife;
-		_maxRenew         = maxRenew;
-		_kdcFlags         = kdcFlags;
-		_realmName        = realmName;
+	private KerberosTime  validStart;
+	private KerberosTime  validEnd;
+	private KerberosTime  passwordEnd;
+	private int           maxLife;
+	private int           maxRenew;
+	private int           kdcFlags;
+    private SamType       samType = null;
+	private EncryptionKey key;
+
+	private String realmName;
 
-        this.samType = samType;
+	PrincipalStoreEntry( String commonName, KerberosPrincipal principal, int keyVersionNumber,
+            KerberosTime validStart, KerberosTime validEnd, KerberosTime passwordEnd, int maxLife,
+            int maxRenew, int kdcFlags, int keyType, byte[] key, String realmName, SamType samType )
+    {
+		this.commonName  = commonName;
+		this.principal   = principal;
+		this.validStart  = validStart;
+		this.validEnd    = validEnd;
+		this.passwordEnd = passwordEnd;
+		this.maxLife     = maxLife;
+		this.maxRenew    = maxRenew;
+		this.kdcFlags    = kdcFlags;
+		this.realmName   = realmName;
+        this.samType     = samType;
 
-		_key = new EncryptionKey(EncryptionType.getTypeByOrdinal(keyType), key, keyVersionNumber);
+		this.key = new EncryptionKey(EncryptionType.getTypeByOrdinal(keyType), key, keyVersionNumber);
 	}
 	
-	public String getCommonName() {
-		return _commonName;
-	}
-	public EncryptionKey getEncryptionKey() {
-		return _key;
-	}
-	public int getKDCFlags() {
-		return _kdcFlags;
-	}
-	public int getMaxLife() {
-		return _maxLife;
-	}
-	public int getMaxRenew() {
-		return _maxRenew;
-	}
-	public KerberosTime getPasswordEnd() {
-		return _passwordEnd;
-	}
-	public KerberosPrincipal getPrincipal() {
-		return _principal;
-	}
-	public String getRealmName() {
-		return _realmName;
-	}
-	public KerberosTime getValidEnd() {
-		return _validEnd;
-	}
-	public KerberosTime getValidStart() {
-		return _validStart;
-	}
+	public String getCommonName()
+    {
+        return commonName;
+    }
+
+    public EncryptionKey getEncryptionKey()
+    {
+        return key;
+    }
+
+    public int getKDCFlags()
+    {
+        return kdcFlags;
+    }
+
+    public int getMaxLife()
+    {
+        return maxLife;
+    }
+
+    public int getMaxRenew()
+    {
+        return maxRenew;
+    }
+
+    public KerberosTime getPasswordEnd()
+    {
+        return passwordEnd;
+    }
+
+    public KerberosPrincipal getPrincipal()
+    {
+        return principal;
+    }
+
+    public String getRealmName()
+    {
+        return realmName;
+    }
+
+    public KerberosTime getValidEnd()
+    {
+        return validEnd;
+    }
+
+    public KerberosTime getValidStart()
+    {
+        return validStart;
+    }
 
     public SamType getSamType()
     {
         return samType;
     }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java Tue Aug 23 21:37:55 2005
@@ -21,73 +21,96 @@
 import org.apache.kerberos.messages.value.KerberosTime;
 import org.apache.kerberos.messages.value.SamType;
 
-public class PrincipalStoreEntryModifier {
-	
+public class PrincipalStoreEntryModifier
+{
 	// 'Principal'
-	private String            _commonName;
-	private KerberosPrincipal _principal;
-	
+	private String            commonName;
+	private KerberosPrincipal principal;
+
 	// 'KDCEntry'
-	private int _keyVersionNumber; // must
+	private int keyVersionNumber; // must
 	// may
-	private KerberosTime _validStart;
-	private KerberosTime _validEnd;
-	private KerberosTime _passwordEnd;
-	private int          _maxLife;
-	private int          _maxRenew;
-	private int          _kdcFlags;
-	private int          _encryptionType;
+	private KerberosTime validStart;
+	private KerberosTime validEnd;
+	private KerberosTime passwordEnd;
+	private int          maxLife;
+	private int          maxRenew;
+	private int          kdcFlags;
+	private int          encryptionType;
     private SamType      samType;
-	private byte[]       _key;
-	
-	private String _realmName;
-	
-	public PrincipalStoreEntry getEntry() {
-		return new PrincipalStoreEntry(_commonName, _principal, _keyVersionNumber,
-				_validStart, _validEnd, _passwordEnd, _maxLife, _maxRenew,
-				_kdcFlags, _encryptionType, _key, _realmName, samType);
-	}
-
-	public void setCommonName(String commonName) {
-		_commonName = commonName;
-	}
-	public void setEncryptionType(int encryptionType) {
-		_encryptionType = encryptionType;
-	}
-	public void setKDCFlags(int kdcFlags) {
-		_kdcFlags = kdcFlags;
-	}
-	public void setKey(byte[] key) {
-		_key = key;
-	}
-	public void setKeyVersionNumber(int keyVersionNumber) {
-		_keyVersionNumber = keyVersionNumber;
-	}
-	public void setMaxLife(int maxLife) {
-		_maxLife = maxLife;
-	}
-	public void setMaxRenew(int maxRenew) {
-		_maxRenew = maxRenew;
-	}
-	public void setPasswordEnd(KerberosTime passwordEnd) {
-		_passwordEnd = passwordEnd;
-	}
-	public void setPrincipal(KerberosPrincipal principal) {
-		_principal = principal;
-	}
-	public void setRealmName(String realmName) {
-		_realmName = realmName;
-	}
-	public void setValidEnd(KerberosTime validEnd) {
-		_validEnd = validEnd;
-	}
-    public void setValidStart(KerberosTime validStart) {
-        _validStart = validStart;
+	private byte[]       key;
+
+	private String realmName;
+
+	public PrincipalStoreEntry getEntry()
+    {
+        return new PrincipalStoreEntry( commonName, principal, keyVersionNumber, validStart,
+                validEnd, passwordEnd, maxLife, maxRenew, kdcFlags, encryptionType, key, realmName,
+                samType );
     }
 
-    public void setSamType( SamType samType ) 
+    public void setCommonName( String commonName )
+    {
+        this.commonName = commonName;
+    }
+
+    public void setEncryptionType( int encryptionType )
+    {
+        this.encryptionType = encryptionType;
+    }
+
+    public void setKDCFlags( int kdcFlags )
+    {
+        this.kdcFlags = kdcFlags;
+    }
+
+    public void setKey( byte[] key )
+    {
+        this.key = key;
+    }
+
+    public void setKeyVersionNumber( int keyVersionNumber )
+    {
+        this.keyVersionNumber = keyVersionNumber;
+    }
+
+    public void setMaxLife( int maxLife )
+    {
+        this.maxLife = maxLife;
+    }
+
+    public void setMaxRenew( int maxRenew )
+    {
+        this.maxRenew = maxRenew;
+    }
+
+    public void setPasswordEnd( KerberosTime passwordEnd )
+    {
+        this.passwordEnd = passwordEnd;
+    }
+
+    public void setPrincipal( KerberosPrincipal principal )
+    {
+        this.principal = principal;
+    }
+
+    public void setRealmName( String realmName )
+    {
+        this.realmName = realmName;
+    }
+
+    public void setValidEnd( KerberosTime validEnd )
+    {
+        this.validEnd = validEnd;
+    }
+
+    public void setValidStart( KerberosTime validStart )
+    {
+        this.validStart = validStart;
+    }
+
+    public void setSamType( SamType samType )
     {
         this.samType = samType;
     }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/ChangePassword.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/ChangePassword.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/ChangePassword.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/ChangePassword.java Tue Aug 23 21:37:55 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.store.operations;
 
 import javax.naming.Name;
@@ -47,7 +46,7 @@
     protected KerberosPrincipal principal;
     /** The new key for the update. */
     protected KerberosKey newKey;
-    
+
     /**
      * Creates the action to be used against the embedded ApacheDS DIT.
      */
@@ -56,68 +55,69 @@
         this.principal = principal;
         this.newKey = newKey;
     }
-    
+
     public Object execute( DirContext ctx, Name searchBaseDn )
-	{
+    {
         if ( principal == null )
         {
             return null;
         }
-        
-	    ModificationItem[] mods = new ModificationItem[ 1 ];
-	    Attribute newKeyAttribute = new BasicAttribute( "krb5key", newKey.getEncoded() );
-		mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, newKeyAttribute );
-		
-		String dn = null;
-		
-		try
-		{
-		    dn = search( ctx, searchBaseDn, principal.getName() );
-		    Name rdn = getRelativeName( ctx, dn );
-		    ctx.modifyAttributes( rdn, mods );
-		}
-		catch (NamingException e)
-		{
-			e.printStackTrace();
-			return null;
-		}
-		
-		return dn;
-	}
-    
-	private String search( DirContext ctx, Name searchBaseDn, String principal ) throws NamingException
-	{
-		String[] attrIDs = { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION,
-		        KerberosAttribute.TYPE, KerberosAttribute.KEY };
-
-		Attributes matchAttrs = new BasicAttributes(false); // case-sensitive
-		matchAttrs.put( new BasicAttribute( KerberosAttribute.PRINCIPAL, principal ) );
-		
-		// Search for objects that have those matching attributes
-		NamingEnumeration answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
-		
-		if ( answer.hasMore() )
-		{
-			SearchResult sr = (SearchResult) answer.next();
-			if ( sr != null )
-			{
-				return sr.getName();
-			}
-		}
-		
-		return null;
-	}
-	
+
+        ModificationItem[] mods = new ModificationItem[ 1 ];
+        Attribute newKeyAttribute = new BasicAttribute( "krb5key", newKey.getEncoded() );
+        mods[ 0 ] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, newKeyAttribute );
+
+        String dn = null;
+
+        try
+        {
+            dn = search( ctx, searchBaseDn, principal.getName() );
+            Name rdn = getRelativeName( ctx, dn );
+            ctx.modifyAttributes( rdn, mods );
+        }
+        catch ( NamingException e )
+        {
+            e.printStackTrace();
+            return null;
+        }
+
+        return dn;
+    }
+
+    private String search( DirContext ctx, Name searchBaseDn, String principal )
+            throws NamingException
+    {
+        String[] attrIDs = { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION,
+                KerberosAttribute.TYPE, KerberosAttribute.KEY };
+
+        Attributes matchAttrs = new BasicAttributes( false ); // case-sensitive
+        matchAttrs.put( new BasicAttribute( KerberosAttribute.PRINCIPAL, principal ) );
+
+        // Search for objects that have those matching attributes
+        NamingEnumeration answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
+
+        if ( answer.hasMore() )
+        {
+            SearchResult sr = (SearchResult) answer.next();
+            if ( sr != null )
+            {
+                return sr.getName();
+            }
+        }
+
+        return null;
+    }
+
     private Name getRelativeName( DirContext ctx, String baseDn )
     {
         Name searchBaseDn = null;
-        
+
         try
         {
             LdapName ctxRoot = new LdapName( ctx.getNameInNamespace() );
 
             searchBaseDn = new LdapName( baseDn );
-            
+
             if ( searchBaseDn.startsWith( ctxRoot ) )
             {
                 for ( int ii = 0; ii < ctxRoot.size(); ii++ )
@@ -128,18 +128,17 @@
             else
             {
                 String msg = "Failed to create initial context for ApacheDS provider";
-                
+
                 throw new IllegalArgumentException( msg );
             }
         }
         catch ( NamingException e )
         {
             String msg = "Failed to find search base for ApacheDS store";
-            
+
             throw new NestableRuntimeException( msg, e );
         }
-        
+
         return searchBaseDn;
     }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java?rev=239526&r1=239525&r2=239526&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java (original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/store/operations/GetPrincipal.java Tue Aug 23 21:37:55 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.store.operations;
 
 import javax.naming.Name;
@@ -27,13 +26,13 @@
 import javax.naming.directory.SearchResult;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.kerberos.messages.value.SamType;
 import org.apache.kerberos.store.ContextOperation;
 import org.apache.kerberos.store.KerberosAttribute;
 import org.apache.kerberos.store.PrincipalStoreEntry;
 import org.apache.kerberos.store.PrincipalStoreEntryModifier;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
 
 /**
  * Encapsulates the action of looking up a principal in an embedded ApacheDS DIT.
@@ -47,7 +46,6 @@
     /** The name of the principal to get. */
     private final KerberosPrincipal principal;
 
-
     /**
      * Creates the action to be used against the embedded ApacheDS DIT.
      */
@@ -56,7 +54,6 @@
         this.principal = principal;
     }
 
-
     /**
      * Gets the KerberosPrincipal associated with this context operation.
      * @return
@@ -66,61 +63,55 @@
         return principal;
     }
 
-
     /**
      * Note that the base is a relative path from the exiting context.
      * It is not a DN.
      */
     public Object execute( DirContext ctx, Name base )
-	{
+    {
         if ( principal == null )
         {
             return null;
         }
-        
-		String[] attrIDs = {
-
-            KerberosAttribute.PRINCIPAL,  KerberosAttribute.VERSION,
 
-            KerberosAttribute.TYPE,  KerberosAttribute.KEY, KerberosAttribute.SAM_TYPE
-        };
+        String[] attrIDs = { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION,
+                KerberosAttribute.TYPE, KerberosAttribute.KEY, KerberosAttribute.SAM_TYPE };
 
-		Attributes matchAttrs = new BasicAttributes( false ); // case-sensitive
+        Attributes matchAttrs = new BasicAttributes( false ); // case-sensitive
 
         matchAttrs.put( new BasicAttribute( KerberosAttribute.PRINCIPAL, principal.getName() ) );
-		
-		PrincipalStoreEntry entry = null;
-		
-		try
-		{
-		    // Search for objects that have those matching attributes
+
+        PrincipalStoreEntry entry = null;
+
+        try
+        {
+            // Search for objects that have those matching attributes
 
             NamingEnumeration answer = ctx.search( base, matchAttrs, attrIDs );
-		    
-			if ( answer.hasMore() )
-			{
-				SearchResult result = ( SearchResult ) answer.next();
+
+            if ( answer.hasMore() )
+            {
+                SearchResult result = (SearchResult) answer.next();
 
                 Attributes attrs = result.getAttributes();
-	            
-	            if ( attrs == null )
-	            {
-	                return null;
-	            }
-	            
-	            entry = getEntry( attrs );
-			}
-		}
-		catch ( NamingException e )
-		{
-			e.printStackTrace();
+
+                if ( attrs == null )
+                {
+                    return null;
+                }
+
+                entry = getEntry( attrs );
+            }
+        }
+        catch ( NamingException e )
+        {
+            e.printStackTrace();
 
             return null;
-		}
-		
-		return entry;
-    }
+        }
 
+        return entry;
+    }
 
     /**
      * Marshals an a PrincipalStoreEntry from an Attributes object.
@@ -132,28 +123,27 @@
     private PrincipalStoreEntry getEntry( Attributes attrs ) throws NamingException
     {
         PrincipalStoreEntryModifier modifier = new PrincipalStoreEntryModifier();
-        String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
-        String encryptionType = ( String ) attrs.get( KerberosAttribute.TYPE ).get();
-        String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
+        String principal = (String) attrs.get( KerberosAttribute.PRINCIPAL ).get();
+        String encryptionType = (String) attrs.get( KerberosAttribute.TYPE ).get();
+        String keyVersionNumber = (String) attrs.get( KerberosAttribute.VERSION ).get();
 
         if ( attrs.get( KerberosAttribute.SAM_TYPE ) != null )
         {
-            String samType = ( String ) attrs.get( KerberosAttribute.SAM_TYPE ).get();
+            String samType = (String) attrs.get( KerberosAttribute.SAM_TYPE ).get();
             modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
         }
 
         Object key = attrs.get( KerberosAttribute.KEY ).get();
         byte[] keyBytes = null;
+
         if ( key instanceof String )
         {
             String msg = "JNDI should not return a string for the kerberos key: JNDI property java.naming.ldap.attributes.binary must include the krb5key attribute.";
             log.error( msg );
             throw new NamingException( msg );
         }
-        else
-        {
-            keyBytes = (byte[]) key;
-        }
+
+        keyBytes = (byte[]) key;
         modifier.setKey( keyBytes );
 
         modifier.setPrincipal( new KerberosPrincipal( principal ) );
@@ -162,4 +152,3 @@
         return modifier.getEntry();
     }
 }
-