You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/11/04 04:25:10 UTC
svn commit: rev 56559 - in incubator/directory/kerberos/trunk: . kerberos kerberos/src/java/org/apache/kerberos/kdc kerberos/src/test/org/apache/kerberos/kdc
Author: akarasulu
Date: Wed Nov 3 19:25:09 2004
New Revision: 56559
Added:
incubator/directory/kerberos/trunk/kerberos/src/test/org/apache/kerberos/kdc/
incubator/directory/kerberos/trunk/kerberos/src/test/org/apache/kerberos/kdc/KdcConfigurationTest.java
Modified:
incubator/directory/kerberos/trunk/ (props changed)
incubator/directory/kerberos/trunk/kerberos/ (props changed)
incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/KdcConfiguration.java
incubator/directory/kerberos/trunk/project.xml
Log:
Changes ...
o made configuration start using default properties packaged as a jar resource
o made maven move default properties files over to the o.a.k.kdc target output dir
Modified: incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/KdcConfiguration.java
==============================================================================
--- incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/KdcConfiguration.java (original)
+++ incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/KdcConfiguration.java Wed Nov 3 19:25:09 2004
@@ -24,7 +24,15 @@
import javax.security.auth.kerberos.*;
public class KdcConfiguration {
-
+ /** the defaults resource file */
+ private static final String DEFAULTS = "kerberos.properties";
+
+ /** the prop key const for kdc.primary.realm */
+ 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;
@@ -32,10 +40,11 @@
private Properties _properties = new Properties();
private EncryptionType[] _encryptionTypes;
-
- public KdcConfiguration() {
+
+
+ public KdcConfiguration() {
try {
- _properties.load(new FileInputStream("kerberos.properties"));
+ _properties.load( getClass().getResourceAsStream( DEFAULTS ) );
} catch (IOException e) {
e.printStackTrace();
}
@@ -44,12 +53,12 @@
}
public String getPrimaryRealm() {
- String key = "kdc.primary.realm";
+ String key = KDC_PRIMARY_REALM;
return (String)_properties.get(key);
}
public KerberosPrincipal getKdcPrincipal() {
- String key = "kdc.principal";
+ String key = KDC_PRINCIPAL;
return new KerberosPrincipal((String)_properties.get(key));
}
Added: incubator/directory/kerberos/trunk/kerberos/src/test/org/apache/kerberos/kdc/KdcConfigurationTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/kerberos/trunk/kerberos/src/test/org/apache/kerberos/kdc/KdcConfigurationTest.java Wed Nov 3 19:25:09 2004
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.kerberos.kdc;
+
+
+import junit.framework.TestCase;
+
+
+/**
+ * Document this class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class KdcConfigurationTest extends TestCase
+{
+ public void testDefaults()
+ {
+ KdcConfiguration config = new KdcConfiguration();
+ assertEquals( config.getPrimaryRealm(), "25OZ.COM" );
+ assertEquals( config.getKdcPrincipal().getName(), "krbtgt/25OZ.COM@25OZ.COM" );
+ }
+}
Modified: incubator/directory/kerberos/trunk/project.xml
==============================================================================
--- incubator/directory/kerberos/trunk/project.xml (original)
+++ incubator/directory/kerberos/trunk/project.xml Wed Nov 3 19:25:09 2004
@@ -137,10 +137,10 @@
</resource>
<resource>
- <directory>${basedir}/conf</directory>
- <targetPath>BLOCK-INF</targetPath>
+ <directory>${basedir}/etc</directory>
+ <targetPath>org/apache/kerberos/kdc</targetPath>
<includes>
- <include>block.xml</include>
+ <include>*.properties</include>
</includes>
</resource>
</resources>