directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject directory-kerby git commit: Having KdcConfig and KrbConfig extend Conf instead of containing
Date Tue, 17 Mar 2015 22:10:57 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 9ca5d36e4 -> 676554290


Having KdcConfig and KrbConfig extend Conf instead of containing


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/67655429
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/67655429
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/67655429

Branch: refs/heads/master
Commit: 6765542902ed3fc6863db172004a0d38bcf345df
Parents: 9ca5d36
Author: Drankye <drankye@gmail.com>
Authored: Wed Mar 18 06:10:16 2015 +0800
Committer: Drankye <drankye@gmail.com>
Committed: Wed Mar 18 06:10:16 2015 +0800

----------------------------------------------------------------------
 .../kerby/kerberos/tool/TestKdcServer.java      | 106 -------------------
 .../kerby/kerberos/kerb/client/KrbClient.java   |   2 +-
 .../kerby/kerberos/kerb/client/KrbConfig.java   |  80 +++++++-------
 .../kerberos/kerb/client/TestKrbConfigLoad.java |   4 +-
 .../kerberos/kerb/server/TestKdcServer.java     |   2 +-
 .../kerby/kerberos/kerb/server/KdcConfig.java   |  74 ++++++-------
 .../kerby/kerberos/kerb/server/KdcServer.java   |   2 +-
 .../kerberos/kerb/server/TestKdcConfigLoad.java |   4 +-
 8 files changed, 77 insertions(+), 197 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kdc-tool/client-tool/src/test/java/org/apache/kerby/kerberos/tool/TestKdcServer.java
----------------------------------------------------------------------
diff --git a/kdc-tool/client-tool/src/test/java/org/apache/kerby/kerberos/tool/TestKdcServer.java
b/kdc-tool/client-tool/src/test/java/org/apache/kerby/kerberos/tool/TestKdcServer.java
deleted file mode 100644
index c37e7eb..0000000
--- a/kdc-tool/client-tool/src/test/java/org/apache/kerby/kerberos/tool/TestKdcServer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.kerby.kerberos.tool;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.common.EncryptionUtil;
-import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
-import org.apache.kerby.kerberos.kerb.server.KdcConfigKey;
-import org.apache.kerby.kerberos.kerb.server.KdcServer;
-import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
-import org.apache.kerby.kerberos.kerb.spec.common.EncryptionKey;
-import org.apache.kerby.kerberos.kerb.spec.common.EncryptionType;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * A standalone kdc server with some default value for test.
- */
-public class TestKdcServer extends SimpleKdcServer {
-
-    public static final String ORG_DOMAIN = KdcConfigKey.KDC_DOMAIN.getPropertyKey();
-    public static final String KDC_REALM = KdcConfigKey.KDC_REALM.getPropertyKey();
-    public static final String KDC_HOST = KdcConfigKey.KDC_HOST.getPropertyKey();
-    public static final String KDC_TCP_PORT = KdcConfigKey.KDC_TCP_PORT.getPropertyKey();
-
-    private static final Properties DEFAULT_CONFIG = new Properties();
-    static {
-        DEFAULT_CONFIG.setProperty(KDC_HOST, "localhost");
-        DEFAULT_CONFIG.setProperty(KDC_TCP_PORT, "8015");
-        DEFAULT_CONFIG.setProperty(ORG_DOMAIN, "test.com");
-        DEFAULT_CONFIG.setProperty(KDC_REALM, "TEST.COM");
-    }
-
-    public static Properties createConf() {
-        return (Properties) DEFAULT_CONFIG.clone();
-    }
-
-    @Override
-    public void init() {
-        super.init();
-
-        getKdcConfig().getConf().addPropertiesConfig(createConf());
-        
-        createPrincipals("krbtgt", "test-service/localhost");
-
-        createPrincipal("client@TEST.COM", "123456");
-    }
-
-    public static void main(String[] args) {
-        KdcServer server = new TestKdcServer();
-        server.init();
-        server.start();
-        System.out.println("Kdc Server(for test) Started.");
-    }
-
-    public String getKdcRealm() {
-        return getKdcConfig().getKdcRealm();
-    }
-
-    public synchronized void createPrincipal(String principal, String password) {
-        KrbIdentity identity = new KrbIdentity(principal);
-        List<EncryptionType> encTypes = getKdcConfig().getEncryptionTypes();
-        List<EncryptionKey> encKeys = null;
-        try {
-            encKeys = EncryptionUtil.generateKeys(fixPrincipal(principal), password, encTypes);
-        } catch (KrbException e) {
-            throw new RuntimeException("Failed to generate encryption keys", e);
-        }
-        identity.addKeys(encKeys);
-        getIdentityService().addIdentity(identity);
-    }
-
-    public void createPrincipals(String ... principals) {
-        String passwd;
-        for (String principal : principals) {
-            passwd = UUID.randomUUID().toString();
-            createPrincipal(fixPrincipal(principal), passwd);
-        }
-    }
-
-    private String fixPrincipal(String principal) {
-        if (! principal.contains("@")) {
-            principal += "@" + getKdcRealm();
-        }
-        return principal;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
index 2cb6caf..fd4109d 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClient.java
@@ -110,7 +110,7 @@ public class KrbClient {
         if (confDir != null && confDir.exists()) {
             File kdcConfFile = new File(confDir, "krb5.conf");
             if (kdcConfFile.exists()) {
-                krbConfig.getConf().addIniConfig(kdcConfFile);
+                krbConfig.addIniConfig(kdcConfFile);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbConfig.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbConfig.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbConfig.java
index 7f5cf40..8a6271d 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbConfig.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbConfig.java
@@ -25,19 +25,13 @@ import org.apache.kerby.kerberos.kerb.spec.common.EncryptionType;
 
 import java.util.List;
 
-public class KrbConfig {
-    protected Conf conf;
-
-    public KrbConfig() {
-        this.conf = new Conf();
-    }
-
-    public Conf getConf() {
-        return this.conf;
-    }
+/**
+ * Kerb client side configuration API.
+ */
+public class KrbConfig extends Conf {
 
     public boolean enableDebug() {
-        return conf.getBoolean(KrbConfigKey.KRB_DEBUG);
+        return getBoolean(KrbConfigKey.KRB_DEBUG);
     }
 
     /**
@@ -45,7 +39,7 @@ public class KrbConfig {
      * @return
      */
     public String getKdcHost() {
-        return conf.getString(KrbConfigKey.KDC_HOST);
+        return getString(KrbConfigKey.KDC_HOST);
     }
 
     /**
@@ -53,7 +47,7 @@ public class KrbConfig {
      * @return
      */
     public int getKdcPort() {
-        Integer kdcPort = conf.getInt(KrbConfigKey.KDC_PORT);
+        Integer kdcPort = getInt(KrbConfigKey.KDC_PORT);
         return kdcPort.shortValue();
     }
 
@@ -62,7 +56,7 @@ public class KrbConfig {
      * @return
      */
     public int getKdcTcpPort() {
-        Integer kdcPort = conf.getInt(KrbConfigKey.KDC_TCP_PORT);
+        Integer kdcPort = getInt(KrbConfigKey.KDC_TCP_PORT);
         if (kdcPort > 0) {
             return kdcPort.shortValue();
         }
@@ -74,7 +68,7 @@ public class KrbConfig {
      * @return true to allow UDP, false otherwise
      */
     public boolean allowKdcUdp() {
-        return conf.getBoolean(KrbConfigKey.KDC_ALLOW_UDP);
+        return getBoolean(KrbConfigKey.KDC_ALLOW_UDP);
     }
 
     /**
@@ -82,7 +76,7 @@ public class KrbConfig {
      * @return
      */
     public int getKdcUdpPort() {
-        Integer kdcPort = conf.getInt(KrbConfigKey.KDC_UDP_PORT);
+        Integer kdcPort = getInt(KrbConfigKey.KDC_UDP_PORT);
         if (kdcPort > 0) {
             return kdcPort.shortValue();
         }
@@ -90,111 +84,111 @@ public class KrbConfig {
     }
 
     public String getKdcRealm() {
-        return KrbConfHelper.getStringUnderSection(conf, KrbConfigKey.KDC_REALM);
+        return KrbConfHelper.getStringUnderSection(this, KrbConfigKey.KDC_REALM);
     }
 
     public String getKdcDomain() {
-        return conf.getString(KrbConfigKey.KDC_DOMAIN);
+        return getString(KrbConfigKey.KDC_DOMAIN);
     }
 
     public boolean isPreauthRequired() {
-        return conf.getBoolean(KrbConfigKey.PREAUTH_REQUIRED);
+        return getBoolean(KrbConfigKey.PREAUTH_REQUIRED);
     }
 
     public String getTgsPrincipal() {
-        return conf.getString(KrbConfigKey.TGS_PRINCIPAL);
+        return getString(KrbConfigKey.TGS_PRINCIPAL);
     }
 
     public long getAllowableClockSkew() {
-        return KrbConfHelper.getLongUnderSection(conf, KrbConfigKey.CLOCKSKEW);
+        return KrbConfHelper.getLongUnderSection(this, KrbConfigKey.CLOCKSKEW);
     }
 
     public boolean isEmptyAddressesAllowed() {
-        return conf.getBoolean(KrbConfigKey.EMPTY_ADDRESSES_ALLOWED);
+        return getBoolean(KrbConfigKey.EMPTY_ADDRESSES_ALLOWED);
     }
 
     public boolean isForwardableAllowed() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KrbConfigKey.FORWARDABLE);
+        return KrbConfHelper.getBooleanUnderSection(this, KrbConfigKey.FORWARDABLE);
     }
 
     public boolean isPostdatedAllowed() {
-        return conf.getBoolean(KrbConfigKey.POSTDATED_ALLOWED);
+        return getBoolean(KrbConfigKey.POSTDATED_ALLOWED);
     }
 
     public boolean isProxiableAllowed() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KrbConfigKey.PROXIABLE);
+        return KrbConfHelper.getBooleanUnderSection(this, KrbConfigKey.PROXIABLE);
     }
 
     public boolean isRenewableAllowed() {
-        return conf.getBoolean(KrbConfigKey.RENEWABLE_ALLOWED);
+        return getBoolean(KrbConfigKey.RENEWABLE_ALLOWED);
     }
 
     public long getMaximumRenewableLifetime() {
-        return conf.getLong(KrbConfigKey.MAXIMUM_RENEWABLE_LIFETIME);
+        return getLong(KrbConfigKey.MAXIMUM_RENEWABLE_LIFETIME);
     }
 
     public long getMaximumTicketLifetime() {
-        return conf.getLong(KrbConfigKey.MAXIMUM_TICKET_LIFETIME);
+        return getLong(KrbConfigKey.MAXIMUM_TICKET_LIFETIME);
     }
 
     public long getMinimumTicketLifetime() {
-        return conf.getLong(KrbConfigKey.MINIMUM_TICKET_LIFETIME);
+        return getLong(KrbConfigKey.MINIMUM_TICKET_LIFETIME);
     }
 
     public List<EncryptionType> getEncryptionTypes() {
-        return KrbConfHelper.getEncTypesUnderSection(conf, KrbConfigKey.PERMITTED_ENCTYPES);
+        return KrbConfHelper.getEncTypesUnderSection(this, KrbConfigKey.PERMITTED_ENCTYPES);
     }
 
     public boolean isPaEncTimestampRequired() {
-        return conf.getBoolean(KrbConfigKey.PA_ENC_TIMESTAMP_REQUIRED);
+        return getBoolean(KrbConfigKey.PA_ENC_TIMESTAMP_REQUIRED);
     }
 
     public boolean isBodyChecksumVerified() {
-        return conf.getBoolean(KrbConfigKey.VERIFY_BODY_CHECKSUM);
+        return getBoolean(KrbConfigKey.VERIFY_BODY_CHECKSUM);
     }
 
     public String getDefaultRealm() {
-        return KrbConfHelper.getStringUnderSection(conf, KrbConfigKey.DEFAULT_REALM);
+        return KrbConfHelper.getStringUnderSection(this, KrbConfigKey.DEFAULT_REALM);
     }
 
     public boolean getDnsLookUpKdc() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KrbConfigKey.DNS_LOOKUP_KDC);
+        return KrbConfHelper.getBooleanUnderSection(this, KrbConfigKey.DNS_LOOKUP_KDC);
     }
 
     public boolean getDnsLookUpRealm() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KrbConfigKey.DNS_LOOKUP_REALM);
+        return KrbConfHelper.getBooleanUnderSection(this, KrbConfigKey.DNS_LOOKUP_REALM);
     }
 
     public boolean getAllowWeakCrypto() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KrbConfigKey.ALLOW_WEAK_CRYPTO);
+        return KrbConfHelper.getBooleanUnderSection(this, KrbConfigKey.ALLOW_WEAK_CRYPTO);
     }
 
     public long getTicketLifetime() {
-        return KrbConfHelper.getLongUnderSection(conf, KrbConfigKey.TICKET_LIFETIME);
+        return KrbConfHelper.getLongUnderSection(this, KrbConfigKey.TICKET_LIFETIME);
     }
 
     public long getRenewLifetime() {
-        return KrbConfHelper.getLongUnderSection(conf, KrbConfigKey.RENEW_LIFETIME);
+        return KrbConfHelper.getLongUnderSection(this, KrbConfigKey.RENEW_LIFETIME);
     }
 
     public List<EncryptionType> getDefaultTgsEnctypes() {
-        return KrbConfHelper.getEncTypesUnderSection(conf, KrbConfigKey.DEFAULT_TGS_ENCTYPES);
+        return KrbConfHelper.getEncTypesUnderSection(this, KrbConfigKey.DEFAULT_TGS_ENCTYPES);
     }
 
     public List<EncryptionType> getDefaultTktEnctypes() {
-        return KrbConfHelper.getEncTypesUnderSection(conf, KrbConfigKey.DEFAULT_TKT_ENCTYPES);
+        return KrbConfHelper.getEncTypesUnderSection(this, KrbConfigKey.DEFAULT_TKT_ENCTYPES);
     }
 
     public String getDefaultLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KrbConfigKey.DEFAULT);
+        return KrbConfHelper.getStringUnderSection(this, KrbConfigKey.DEFAULT);
     }
 
     public String getKdcLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KrbConfigKey.KDC);
+        return KrbConfHelper.getStringUnderSection(this, KrbConfigKey.KDC);
     }
 
     public String getAdminLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KrbConfigKey.ADMIN_SERVER);
+        return KrbConfHelper.getStringUnderSection(this, KrbConfigKey.ADMIN_SERVER);
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-client/src/test/java/org/apache/kerby/kerberos/kerb/client/TestKrbConfigLoad.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/test/java/org/apache/kerby/kerberos/kerb/client/TestKrbConfigLoad.java
b/kerby-kerb/kerb-client/src/test/java/org/apache/kerby/kerberos/kerb/client/TestKrbConfigLoad.java
index a840fd7..ba9e2f3 100644
--- a/kerby-kerb/kerb-client/src/test/java/org/apache/kerby/kerberos/kerb/client/TestKrbConfigLoad.java
+++ b/kerby-kerb/kerb-client/src/test/java/org/apache/kerby/kerberos/kerb/client/TestKrbConfigLoad.java
@@ -19,7 +19,6 @@
  */
 package org.apache.kerby.kerberos.kerb.client;
 
-import org.apache.kerby.config.Conf;
 import org.apache.kerby.kerberos.kerb.spec.common.EncryptionType;
 import org.junit.Test;
 
@@ -42,8 +41,7 @@ public class TestKrbConfigLoad {
         File confFile = new File(confFileUrl.toURI());
 
         KrbConfig krbConfig = new KrbConfig();
-        Conf conf = krbConfig.getConf();
-        conf.addIniConfig(confFile);
+        krbConfig.addIniConfig(confFile);
 
         assertThat(krbConfig.getDefaultRealm()).isEqualTo("KRB.COM");
         assertThat(krbConfig.getKdcRealm()).isEqualTo("TEST.COM");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
index d291eb8..595a387 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcServer.java
@@ -58,7 +58,7 @@ public class TestKdcServer extends SimpleKdcServer {
     public void init() {
         super.init();
 
-        getKdcConfig().getConf().addPropertiesConfig(createConf());
+        getKdcConfig().addPropertiesConfig(createConf());
 
         createPrincipals("krbtgt");
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcConfig.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcConfig.java
b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcConfig.java
index 6cb8d79..5443879 100644
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcConfig.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcConfig.java
@@ -20,43 +20,36 @@
 package org.apache.kerby.kerberos.kerb.server;
 
 import org.apache.kerby.config.Conf;
-import org.apache.kerby.config.Config;
 import org.apache.kerby.kerberos.kerb.common.KrbConfHelper;
 import org.apache.kerby.kerberos.kerb.spec.common.EncryptionType;
 
 import java.util.List;
 
-public class KdcConfig {
-    protected Conf conf;
-
-    public KdcConfig() {
-        this.conf = new Conf();
-    }
-
-    public Conf getConf() {
-        return this.conf;
-    }
+/**
+ * Kerb KDC side configuration API.
+ */
+public class KdcConfig extends Conf {
 
     public boolean enableDebug() {
-        return conf.getBoolean(KdcConfigKey.KRB_DEBUG);
+        return getBoolean(KdcConfigKey.KRB_DEBUG);
     }
 
     public String getKdcServiceName() {
-        return conf.getString(KdcConfigKey.KDC_SERVICE_NAME);
+        return getString(KdcConfigKey.KDC_SERVICE_NAME);
     }
 
     public String getKdcHost() {
-        return KrbConfHelper.getStringUnderSection(conf, KdcConfigKey.KDC_HOST);
+        return KrbConfHelper.getStringUnderSection(this, KdcConfigKey.KDC_HOST);
     }
 
     public int getKdcPort() {
-        Integer kdcPort =  KrbConfHelper.getIntUnderSection(conf,
+        Integer kdcPort =  KrbConfHelper.getIntUnderSection(this,
                 KdcConfigKey.KDC_PORT);
         return kdcPort.intValue();
     }
 
     public int getKdcTcpPort() {
-        Integer kdcTcpPort =  KrbConfHelper.getIntUnderSection(conf,
+        Integer kdcTcpPort =  KrbConfHelper.getIntUnderSection(this,
                 KdcConfigKey.KDC_TCP_PORT);
         if (kdcTcpPort > 0) {
             return kdcTcpPort.intValue();
@@ -69,11 +62,11 @@ public class KdcConfig {
      * @return true to allow UDP, false otherwise
      */
     public boolean allowKdcUdp() {
-        return conf.getBoolean(KdcConfigKey.KDC_ALLOW_UDP);
+        return getBoolean(KdcConfigKey.KDC_ALLOW_UDP);
     }
 
     public int getKdcUdpPort() {
-        Integer kdcUdpPort = KrbConfHelper.getIntUnderSection(conf,
+        Integer kdcUdpPort = KrbConfHelper.getIntUnderSection(this,
                 KdcConfigKey.KDC_UDP_PORT);
         if (kdcUdpPort > 0) {
             return kdcUdpPort.intValue();
@@ -82,87 +75,90 @@ public class KdcConfig {
     }
 
     public String getKdcRealm() {
-        return KrbConfHelper.getStringUnderSection(conf, KdcConfigKey.KDC_REALM);
+        return KrbConfHelper.getStringUnderSection(this, KdcConfigKey.KDC_REALM);
     }
 
     public String getKdcDomain() {
-        return conf.getString(KdcConfigKey.KDC_DOMAIN);
+        return getString(KdcConfigKey.KDC_DOMAIN);
     }
 
     public boolean isPreauthRequired() {
-        return conf.getBoolean(KdcConfigKey.PREAUTH_REQUIRED);
+        return getBoolean(KdcConfigKey.PREAUTH_REQUIRED);
     }
 
     public String getTgsPrincipal() {
-        return conf.getString(KdcConfigKey.TGS_PRINCIPAL);
+        return getString(KdcConfigKey.TGS_PRINCIPAL);
     }
 
     public long getAllowableClockSkew() {
-        return conf.getLong(KdcConfigKey.ALLOWABLE_CLOCKSKEW);
+        return getLong(KdcConfigKey.ALLOWABLE_CLOCKSKEW);
     }
 
     public boolean isEmptyAddressesAllowed() {
-        return conf.getBoolean(KdcConfigKey.EMPTY_ADDRESSES_ALLOWED);
+        return getBoolean(KdcConfigKey.EMPTY_ADDRESSES_ALLOWED);
     }
 
     public boolean isForwardableAllowed() {
-        return conf.getBoolean(KdcConfigKey.FORWARDABLE_ALLOWED);
+        return getBoolean(KdcConfigKey.FORWARDABLE_ALLOWED);
     }
 
     public boolean isPostdatedAllowed() {
-        return conf.getBoolean(KdcConfigKey.POSTDATED_ALLOWED);
+        return getBoolean(KdcConfigKey.POSTDATED_ALLOWED);
     }
 
     public boolean isProxiableAllowed() {
-        return conf.getBoolean(KdcConfigKey.PROXIABLE_ALLOWED);
+        return getBoolean(KdcConfigKey.PROXIABLE_ALLOWED);
     }
 
     public boolean isRenewableAllowed() {
-        return conf.getBoolean(KdcConfigKey.RENEWABLE_ALLOWED);
+        return getBoolean(KdcConfigKey.RENEWABLE_ALLOWED);
     }
 
     public long getMaximumRenewableLifetime() {
-        return conf.getLong(KdcConfigKey.MAXIMUM_RENEWABLE_LIFETIME);
+        return getLong(KdcConfigKey.MAXIMUM_RENEWABLE_LIFETIME);
     }
 
     public long getMaximumTicketLifetime() {
-        return conf.getLong(KdcConfigKey.MAXIMUM_TICKET_LIFETIME);
+        return getLong(KdcConfigKey.MAXIMUM_TICKET_LIFETIME);
     }
 
     public long getMinimumTicketLifetime() {
-        return conf.getLong(KdcConfigKey.MINIMUM_TICKET_LIFETIME);
+        return getLong(KdcConfigKey.MINIMUM_TICKET_LIFETIME);
     }
 
     public List<EncryptionType> getEncryptionTypes() {
-        List<String> eTypes = conf.getList(KdcConfigKey.ENCRYPTION_TYPES);
+        List<String> eTypes = getList(KdcConfigKey.ENCRYPTION_TYPES);
         return KrbConfHelper.getEncryptionTypes(eTypes);
     }
 
     public boolean isPaEncTimestampRequired() {
-        return conf.getBoolean(KdcConfigKey.PA_ENC_TIMESTAMP_REQUIRED);
+        return getBoolean(KdcConfigKey.PA_ENC_TIMESTAMP_REQUIRED);
     }
 
     public boolean isBodyChecksumVerified() {
-        return conf.getBoolean(KdcConfigKey.VERIFY_BODY_CHECKSUM);
+        return getBoolean(KdcConfigKey.VERIFY_BODY_CHECKSUM);
     }
 
     public String getDefaultLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KdcConfigKey.DEFAULT);
+        return KrbConfHelper.getStringUnderSection(this, KdcConfigKey.DEFAULT);
     }
 
     public String getKdcLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KdcConfigKey.KDC);
+        return KrbConfHelper.getStringUnderSection(this, KdcConfigKey.KDC);
     }
 
     public String getAdminLoggingLocation() {
-        return KrbConfHelper.getStringUnderSection(conf, KdcConfigKey.ADMIN_SERVER);
+        return KrbConfHelper.getStringUnderSection(this,
+                KdcConfigKey.ADMIN_SERVER);
     }
 
     public boolean isRestrictAnonymousToTgt() {
-        return KrbConfHelper.getBooleanUnderSection(conf, KdcConfigKey.RESTRICT_ANONYMOUS_TO_TGT);
+        return KrbConfHelper.getBooleanUnderSection(this,
+                KdcConfigKey.RESTRICT_ANONYMOUS_TO_TGT);
     }
 
     public int getKdcMaxDgramReplySize() {
-        return KrbConfHelper.getIntUnderSection(conf, KdcConfigKey.KDC_MAX_DGRAM_REPLY_SIZE);
+        return KrbConfHelper.getIntUnderSection(this,
+                KdcConfigKey.KDC_MAX_DGRAM_REPLY_SIZE);
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
index 353b087..8f8107e 100644
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/KdcServer.java
@@ -108,7 +108,7 @@ public class KdcServer {
         if (confDir != null && confDir.exists()) {
             File kdcConfFile = new File(confDir, "kdc.conf");
             if (kdcConfFile.exists()) {
-                kdcConfig.getConf().addIniConfig(kdcConfFile);
+                kdcConfig.addIniConfig(kdcConfFile);
             }
 
             File backendConfFile = new File(confDir, "backend.conf");

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67655429/kerby-kerb/kerb-server/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcConfigLoad.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcConfigLoad.java
b/kerby-kerb/kerb-server/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcConfigLoad.java
index 55bd799..bdec34b 100644
--- a/kerby-kerb/kerb-server/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcConfigLoad.java
+++ b/kerby-kerb/kerb-server/src/test/java/org/apache/kerby/kerberos/kerb/server/TestKdcConfigLoad.java
@@ -19,7 +19,6 @@
  */
 package org.apache.kerby.kerberos.kerb.server;
 
-import org.apache.kerby.config.Conf;
 import org.junit.Test;
 
 import java.io.File;
@@ -37,8 +36,7 @@ public class TestKdcConfigLoad {
         File confFile = new File(confFileUrl.toURI());
 
         KdcConfig kdcConfig = new KdcConfig();
-        Conf conf = kdcConfig.getConf();
-        conf.addIniConfig(confFile);
+        kdcConfig.addIniConfig(confFile);
 
         assertThat(kdcConfig.getDefaultLoggingLocation()).isEqualTo("FILE:/var/log/krb5libs.log");
         assertThat(kdcConfig.getKdcLoggingLocation()).isEqualTo("FILE:/var/log/krb5kdc.log");


Mime
View raw message