directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r263855 - /directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java
Date Sun, 28 Aug 2005 10:27:02 GMT
Author: erodriguez
Date: Sun Aug 28 03:26:59 2005
New Revision: 263855

URL: http://svn.apache.org/viewcvs?rev=263855&view=rev
Log:
o  Renaming Change Password configuration.
o  Rounding out config options to make it standalone from KDC config.

Modified:
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java?rev=263855&r1=263854&r2=263855&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordConfiguration.java
Sun Aug 28 03:26:59 2005
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2004 The Apache Software Foundation
+ *   Copyright 2005 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.kerberos.service;
+package org.apache.changepw.service;
 
 import java.util.ArrayList;
 import java.util.Hashtable;
@@ -26,44 +26,63 @@
 
 import org.apache.kerberos.crypto.encryption.EncryptionType;
 
-public class ChangepwConfiguration
+public class ChangePasswordConfiguration
 {
-    /** the prop key const for changepw.port */
-    public static final String CHANGEPW_PORT_KEY = "changepw.port";
+    /** the prop key const for changepw.primary.realm */
+    private static final String CHANGEPW_PRIMARY_REALM_KEY = "changepw.primary.realm";
 
     /** the prop key const for changepw.principal */
     private static final String CHANGEPW_PRINCIPAL_KEY = "changepw.principal";
 
-    /** the prop key const for changepw.encryption.types */
-    private static final String CHANGEPW_ENCRYPTION_TYPES = "changepw.encryption.types";
+    /** the prop key const for changepw.port */
+    public static final String CHANGEPW_PORT_KEY = "changepw.port";
 
-    /** the prop key const for changepw.buffer.size */
-    private static final String CHANGEPW_BUFFER_SIZE = "changepw.buffer.size";
+    /** the default change password realm */
+    private static final String CHANGEPW_DEFAULT_REALM = "EXAMPLE.COM";
+
+    /** the default change password principal */
+    private static final String CHANGEPW_DEFAULT_PRINCIPAL = "kadmin/changepw@EXAMPLE.COM";
 
     /** 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";
+    /** the prop key const for changepw.encryption.types */
+    private static final String CHANGEPW_ENCRYPTION_TYPES = "changepw.encryption.types";
+
+    /** the prop key const for changepw.buffer.size */
+    private static final String CHANGEPW_BUFFER_SIZE = "changepw.buffer.size";
 
     /** the default changepw buffer size */
     private static final int CHANGEPW_DEFAULT_BUFFER_SIZE = 1024;
 
+    private static final int MINUTE = 60000;
     private final Properties properties = new Properties();
     private EncryptionType[] encryptionTypes;
 
-    public ChangepwConfiguration()
+    public ChangePasswordConfiguration()
     {
         prepareEncryptionTypes();
     }
 
-    public ChangepwConfiguration( Properties properties )
+    public ChangePasswordConfiguration( Properties properties )
     {
         this.properties.putAll( properties );
 
         prepareEncryptionTypes();
     }
 
+    public String getPrimaryRealm()
+    {
+        String key = CHANGEPW_PRIMARY_REALM_KEY;
+
+        if ( properties.containsKey( key ) )
+        {
+            return properties.getProperty( key );
+        }
+
+        return CHANGEPW_DEFAULT_REALM;
+    }
+
     public EncryptionType[] getEncryptionTypes()
     {
         return encryptionTypes;
@@ -75,6 +94,18 @@
         properties.setProperty( "java.naming.ldap.attributes.binary", "krb5Key" );
 
         return properties;
+    }
+
+    public long getClockSkew()
+    {
+        String key = "kdc.allowable.clockskew";
+
+        if (properties.containsKey(key))
+        {
+            return MINUTE * Long.parseLong(properties.getProperty(key));
+        }
+
+        return MINUTE * 5;
     }
 
     public int getBufferSize()



Mime
View raw message