directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r158579 - directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
Date Tue, 22 Mar 2005 08:42:14 GMT
Author: erodriguez
Date: Tue Mar 22 00:41:59 2005
New Revision: 158579

URL: http://svn.apache.org/viewcvs?view=rev&rev=158579
Log:
Added smart defaults to config.

Modified:
    directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java

Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java?view=diff&r1=158578&r2=158579
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
(original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/service/KdcConfiguration.java
Tue Mar 22 00:41:59 2005
@@ -34,12 +34,15 @@
     private static final String KDC_PRIMARY_REALM = "kdc.primary.realm";
     /** the prop key const for kdc.principal */
     private static final String KDC_PRINCIPAL = "kdc.principal";
-
-
+    
     private static final int DEFAULT_PORT = 88;
     private static final int CHANGEPW_PORT = 464;
     private static final int BUFFER_SIZE = 1024;
     private static final int MINUTE = 1000 * 60;
+    
+    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;
@@ -57,34 +60,31 @@
         prepareEncryptionTypes();
     }
 
-
     public String getPrimaryRealm()
     {
         String key = KDC_PRIMARY_REALM;
-        return ( String ) properties.get( key );
+        if ( properties.containsKey( key ) )
+        {
+            return ( String ) properties.get( key );
+        }
+        return DEFAULT_REALM;
     }
 
-
     public KerberosPrincipal getKdcPrincipal()
     {
         String key = KDC_PRINCIPAL;
-        return new KerberosPrincipal( ( String ) properties.get( key ) );
-    }
-
-
-    public String getKerberosKeysLocation()
-    {
-        String key = "kdc.keys.location";
-        return ( String ) properties.get( key );
+        if ( properties.containsKey( key ) )
+        {
+            return new KerberosPrincipal( ( String ) properties.get( key ) );
+        }
+        return new KerberosPrincipal( DEFAULT_PRINCIPAL );
     }
-
-
+    
     public EncryptionType[] getEncryptionTypes()
     {
         return _encryptionTypes;
     }
 
-
     public Hashtable getProperties()
     {
         // Request that the krb5key value be returned as binary
@@ -93,7 +93,6 @@
         return properties;
     }
 
-
     public long getClockSkew()
     {
         String key = "kdc.allowable.clockskew";
@@ -104,7 +103,6 @@
         return MINUTE * 5;
     }
 
-
     public long getMaximumTicketLifetime()
     {
         String key = "tgs.maximum.ticket.lifetime";
@@ -115,7 +113,6 @@
         return MINUTE * 1440;
     }
 
-
     public long getMaximumRenewableLifetime()
     {
         String key = "tgs.maximum.renewable.lifetime";
@@ -126,7 +123,6 @@
         return MINUTE * 10080;
     }
 
-
     public int getDefaultPort()
     {
         String key = "kdc.default.port";
@@ -137,7 +133,6 @@
         return DEFAULT_PORT;
     }
 
-
     public int getBufferSize()
     {
         String key = "kdc.buffer.size";
@@ -148,7 +143,6 @@
         return BUFFER_SIZE;
     }
 
-
     public boolean isPaEncTimestampRequired()
     {
         String key = "kdc.pa.enc.timestamp.required";
@@ -159,7 +153,6 @@
         return true;
     }
 
-
     public boolean isEmptyAddressesAllowed()
     {
         String key = "tgs.empty.addresses.allowed";
@@ -170,7 +163,6 @@
         return true;
     }
 
-
     public boolean isForwardableAllowed()
     {
         String key = "tgs.forwardable.allowed";
@@ -181,7 +173,6 @@
         return true;
     }
 
-
     public boolean isProxiableAllowed()
     {
         String key = "tgs.proxiable.allowed";
@@ -192,7 +183,6 @@
         return true;
     }
 
-
     public boolean isPostdateAllowed()
     {
         String key = "tgs.postdate.allowed";
@@ -203,7 +193,6 @@
         return true;
     }
 
-
     public boolean isRenewableAllowed()
     {
         String key = "tgs.renewable.allowed";
@@ -214,7 +203,6 @@
         return true;
     }
 
-
     public int getChangepwPort()
     {
         String key = "changepw.default.port";
@@ -228,24 +216,27 @@
     public KerberosPrincipal getChangepwPrincipal()
     {
         String key = "changepw.principal";
-        return new KerberosPrincipal( ( String ) properties.get( key ) );
-    }
-
-    public KerberosPrincipal getLdapPrincipal()
-    {
-        String key = "ldap.principal";
         if ( properties.containsKey( key ) )
         {
             return new KerberosPrincipal( ( String ) properties.get( key ) );
         }
-        return null;
+        return new KerberosPrincipal( DEFAULT_CHANGEPW_PRINCIPAL );
     }
-
+    
     private void prepareEncryptionTypes()
     {
+        String[] encryptionTypes = null;
+        
         String key = "kdc.encryption.types";
-        String[] encryptionTypes = ( ( String ) properties.get( key ) ).split( "\\s" );
-
+        if ( properties.containsKey( key ) )
+        {
+            encryptionTypes = ( ( String ) properties.get( key ) ).split( "\\s" );
+        }
+        else
+        {
+            encryptionTypes = new String[] { "des-cbc-md5" };
+        }
+        
         List encTypes = new ArrayList();
 
         for ( int i = 0; i < encryptionTypes.length; i++ )



Mime
View raw message