directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r233355 - /directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
Date Thu, 18 Aug 2005 19:01:13 GMT
Author: erodriguez
Date: Thu Aug 18 12:01:06 2005
New Revision: 233355

URL: http://svn.apache.org/viewcvs?rev=233355&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/service/KdcConfiguration.java

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/KdcConfiguration.java?rev=233355&r1=233354&r2=233355&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
(original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
Thu Aug 18 12:01:06 2005
@@ -14,8 +14,8 @@
  *   limitations under the License.
  *
  */
-package org.apache.kerberos.service;
 
+package org.apache.kerberos.service;
 
 import java.util.ArrayList;
 import java.util.Hashtable;
@@ -27,306 +27,283 @@
 
 import org.apache.kerberos.crypto.encryption.EncryptionType;
 
-
 public class KdcConfiguration
 {
     /** the prop key const for kdc.primary.realm */
-    private static final String KDC_PRIMARY_REALM = "kdc.primary.realm";
+    private static final String KDC_PRIMARY_REALM_KEY = "kdc.primary.realm";
 
     /** the prop key const for kdc.principal */
-    private static final String KDC_PRINCIPAL = "kdc.principal";
+    private static final String KDC_PRINCIPAL_KEY = "kdc.principal";
 
-    /** the default kerberos port */
-    public static final int DEFAULT_KERBEROS_PORT = 88;
-
-    /** the default change password port */
-    public static final int DEFAULT_CHANGEPW_PORT = 464;
+    /** the prop key const for kdc.port */
+    public static final String KDC_PORT_KEY = "kdc.port";
 
-    /*
-      kdc.default.port is a misnomer ... should just be kdc.port or something
-      since this is used to set it to an alternate port number which is not
-      the default of 88.  The same argument applies to the change password
-      property key name.
-    */
+    /** the default kdc realm */
+    private static final String KDC_DEFAULT_REALM = "EXAMPLE.COM";
 
-    /** the environment property used for setting an alternative kdc port */
-    public static final String KERBEROS_PORT_KEY = "kdc.default.port";
+    /** the default kdc principal */
+    private static final String KDC_DEFAULT_PRINCIPAL = "krbtgt/EXAMPLE.COM@EXAMPLE.COM";
 
-    /** the environment property used for setting the alternative changepw port */
-    public static final String CHANGEPW_PORT_KEY = "changepw.default.port";
+    /** the default kdc port */
+    public static final int KDC_DEFAULT_PORT = 88;
 
     private static final int BUFFER_SIZE = 1024;
-
     private static final int MINUTE = 60000;
-    
-    private static final String DEFAULT_REALM = "EXAMPLE.COM";
-    private static final String DEFAULT_PRINCIPAL = "krbtgt/EXAMPLE.COM@EXAMPLE.COM";
-    private static final String DEFAULT_CHANGEPW_PRINCIPAL = "kadmin/changepw@EXAMPLE.COM";
-
     private final Properties properties = new Properties();
-    private EncryptionType[] _encryptionTypes;
+    private EncryptionType[] encryptionTypes;
 
+    /** the prop key const for changepw.port */
+    public static final String CHANGEPW_PORT_KEY = "changepw.port";
+
+    /** the prop key const for changepw.principal */
+    private static final String CHANGEPW_PRINCIPAL_KEY = "changepw.principal";
+
+    /** the default change password port */
+    public static final int CHANGEPW_DEFAULT_PORT = 464;
+
+    /** the default changepw principal */
+    private static final String CHANGEPW_DEFAULT_PRINCIPAL = "kadmin/changepw@EXAMPLE.COM";
 
     public KdcConfiguration()
     {
         prepareEncryptionTypes();
     }
 
-
-    public KdcConfiguration( Properties properties )
+    public KdcConfiguration(Properties properties)
     {
-        this.properties.putAll( properties );
+        this.properties.putAll(properties);
 
         prepareEncryptionTypes();
     }
 
-
     public String getPrimaryRealm()
     {
-        String key = KDC_PRIMARY_REALM;
+        String key = KDC_PRIMARY_REALM_KEY;
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return properties.getProperty( key );
+            return properties.getProperty(key);
         }
 
-        return DEFAULT_REALM;
+        return KDC_DEFAULT_REALM;
     }
 
-
     public KerberosPrincipal getKdcPrincipal()
     {
-        String key = KDC_PRINCIPAL;
+        String key = KDC_PRINCIPAL_KEY;
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return new KerberosPrincipal( properties.getProperty( key ) );
+            return new KerberosPrincipal(properties.getProperty(key));
         }
 
-        return new KerberosPrincipal( DEFAULT_PRINCIPAL );
+        return new KerberosPrincipal(KDC_DEFAULT_PRINCIPAL);
     }
 
-
     public EncryptionType[] getEncryptionTypes()
     {
-        return _encryptionTypes;
+        return encryptionTypes;
     }
 
-
     public Hashtable getProperties()
     {
         // Request that the krb5key value be returned as binary
 
-        properties.setProperty( "java.naming.ldap.attributes.binary", "krb5Key" );
+        properties.setProperty("java.naming.ldap.attributes.binary", "krb5Key");
 
         return properties;
     }
 
-
     public long getClockSkew()
     {
         String key = "kdc.allowable.clockskew";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return MINUTE * Long.parseLong( properties.getProperty( key ) );
+            return MINUTE * Long.parseLong(properties.getProperty(key));
         }
 
         return MINUTE * 5;
     }
 
-
     public long getMaximumTicketLifetime()
     {
         String key = "tgs.maximum.ticket.lifetime";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return MINUTE * Long.parseLong( properties.getProperty( key ) );
+            return MINUTE * Long.parseLong(properties.getProperty(key));
         }
 
         return MINUTE * 1440;
     }
 
-
     public long getMaximumRenewableLifetime()
     {
         String key = "tgs.maximum.renewable.lifetime";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return MINUTE * Long.parseLong( properties.getProperty( key ) );
+            return MINUTE * Long.parseLong(properties.getProperty(key));
         }
 
         return MINUTE * 10080;
     }
 
-
     public int getDefaultPort()
     {
-        String key = KERBEROS_PORT_KEY;
+        String key = KDC_PORT_KEY;
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return Integer.parseInt( properties.getProperty( key ) );
+            return Integer.parseInt(properties.getProperty(key));
         }
 
-        return DEFAULT_KERBEROS_PORT;
+        return KDC_DEFAULT_PORT;
     }
 
-
     public int getBufferSize()
     {
         String key = "kdc.buffer.size";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return Integer.parseInt( properties.getProperty( key ) );
+            return Integer.parseInt(properties.getProperty(key));
         }
 
         return BUFFER_SIZE;
     }
 
-
     public boolean isPaEncTimestampRequired()
     {
         String key = "kdc.pa.enc.timestamp.required";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public boolean isEmptyAddressesAllowed()
     {
         String key = "tgs.empty.addresses.allowed";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public boolean isForwardableAllowed()
     {
         String key = "tgs.forwardable.allowed";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public boolean isProxiableAllowed()
     {
         String key = "tgs.proxiable.allowed";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public boolean isPostdateAllowed()
     {
         String key = "tgs.postdate.allowed";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public boolean isRenewableAllowed()
     {
         String key = "tgs.renewable.allowed";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return "true".equalsIgnoreCase( properties.getProperty( key ) );
+            return "true".equalsIgnoreCase(properties.getProperty(key));
         }
 
         return true;
     }
 
-
     public int getChangepwPort()
     {
         String key = CHANGEPW_PORT_KEY;
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return Integer.parseInt( properties.getProperty( key ) );
+            return Integer.parseInt(properties.getProperty(key));
         }
 
-        return DEFAULT_CHANGEPW_PORT;
+        return CHANGEPW_DEFAULT_PORT;
     }
 
-
     public KerberosPrincipal getChangepwPrincipal()
     {
-        String key = "changepw.principal";
+        String key = CHANGEPW_PRINCIPAL_KEY;
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            return new KerberosPrincipal( properties.getProperty( key ) );
+            return new KerberosPrincipal(properties.getProperty(key));
         }
 
-        return new KerberosPrincipal( DEFAULT_CHANGEPW_PRINCIPAL );
+        return new KerberosPrincipal(CHANGEPW_DEFAULT_PRINCIPAL);
     }
 
-
     private void prepareEncryptionTypes()
     {
-        String[] encryptionTypes = null;
-        
+        String[] encryptionTypeStrings = null;
+
         String key = "kdc.encryption.types";
 
-        if ( properties.containsKey( key ) )
+        if (properties.containsKey(key))
         {
-            encryptionTypes = ( properties.getProperty( key ) ).split( "\\s" );
+            encryptionTypeStrings = (properties.getProperty(key)).split("\\s");
         }
         else
         {
-            encryptionTypes = new String[] { "des-cbc-md5" };
+            encryptionTypeStrings = new String[] { "des-cbc-md5" };
         }
-        
+
         List encTypes = new ArrayList();
 
-        for ( int i = 0; i < encryptionTypes.length; i++ )
+        for (int i = 0; i < encryptionTypeStrings.length; i++)
         {
-            String enc = encryptionTypes[i];
+            String enc = encryptionTypeStrings[i];
 
             Iterator it = EncryptionType.VALUES.iterator();
 
-            while ( it.hasNext() )
+            while (it.hasNext())
             {
-                EncryptionType type = ( EncryptionType ) it.next();
+                EncryptionType type = (EncryptionType) it.next();
 
-                if ( type.toString().equalsIgnoreCase( enc ) )
+                if (type.toString().equalsIgnoreCase(enc))
                 {
-                    encTypes.add( type );
+                    encTypes.add(type);
                 }
             }
         }
 
-        _encryptionTypes = ( EncryptionType[] ) encTypes.toArray( new EncryptionType[encTypes.size()]
);
+        encryptionTypes = (EncryptionType[]) encTypes.toArray(new EncryptionType[encTypes.size()]);
     }
 }
-



Mime
View raw message