Merge remote-tracking branch 'asf/trunk' into trunk
diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index fef450d..4e286f6 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>kerby-all</artifactId>
     <groupId>org.apache.kerby</groupId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>benchmark</artifactId>
diff --git a/has-project/has-client/pom.xml b/has-project/has-client/pom.xml
index 8170128..f3a90a7 100644
--- a/has-project/has-client/pom.xml
+++ b/has-project/has-client/pom.xml
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>has-project</artifactId>
         <groupId>org.apache.kerby</groupId>
-        <version>1.1.1-SNAPSHOT</version>
+        <version>2.0.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/has-project/has-common/pom.xml b/has-project/has-common/pom.xml
index 4f6f23e..9eedd57 100644
--- a/has-project/has-common/pom.xml
+++ b/has-project/has-common/pom.xml
@@ -5,7 +5,7 @@
   <parent>
       <artifactId>has-project</artifactId>
       <groupId>org.apache.kerby</groupId>
-      <version>1.1.1-SNAPSHOT</version>
+      <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -50,7 +50,7 @@
     <dependency>
       <groupId>org.apache.kerby</groupId>
       <artifactId>kerb-admin</artifactId>
-      <version>1.1.1-SNAPSHOT</version>
+      <version>2.0.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 
diff --git a/has-project/has-plugins/pom.xml b/has-project/has-plugins/pom.xml
new file mode 100644
index 0000000..bc524ae
--- /dev/null
+++ b/has-project/has-plugins/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <artifactId>has-project</artifactId>
+        <groupId>org.apache.kerby</groupId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>has-plugins</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.kerby</groupId>
+            <artifactId>has-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kerby</groupId>
+            <artifactId>has-client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kerby</groupId>
+            <artifactId>has-server</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-dbutils</groupId>
+            <artifactId>commons-dbutils</artifactId>
+            <version>1.6</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/client/mysql/MySQLHasClientPlugin.java b/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/client/mysql/MySQLHasClientPlugin.java
new file mode 100644
index 0000000..675f295
--- /dev/null
+++ b/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/client/mysql/MySQLHasClientPlugin.java
@@ -0,0 +1,68 @@
+/**
+ * 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.has.plugins.client.mysql;
+
+import org.apache.kerby.has.client.AbstractHasClientPlugin;
+import org.apache.kerby.kerberos.kerb.type.base.AuthToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+public class MySQLHasClientPlugin extends AbstractHasClientPlugin {
+    private static final Logger LOG = LoggerFactory.getLogger(MySQLHasClientPlugin.class);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getLoginType() {
+        return "MySQL";
+    }
+
+    @Override
+    protected void doLogin(AuthToken authToken) {
+
+        //Get the ak info from env
+        String userName = System.getenv("userName");
+        String password = System.getenv("password");
+
+        String mysqlUrl = System.getenv("mysqlUrl");
+        String mysqlUser = System.getenv("mysqlUser");
+        String mysqlPasswd = System.getenv("mysqlPasswd");
+
+        LOG.debug("Get the mysql login info successfully.");
+
+        authToken.setIssuer("has");
+        authToken.setSubject(userName);
+
+        final Date now = new Date(new Date().getTime() / 1000 * 1000);
+        authToken.setIssueTime(now);
+        // Set expiration in 60 minutes
+        Date exp = new Date(now.getTime() + 1000 * 60 * 60);
+        authToken.setExpirationTime(exp);
+
+        authToken.addAttribute("user", userName);
+        authToken.addAttribute("secret", password);
+        authToken.addAttribute("mysqlUrl", mysqlUrl);
+        authToken.addAttribute("mysqlUser", mysqlUser);
+        authToken.addAttribute("mysqlPasswd", mysqlPasswd);
+
+        authToken.addAttribute("passPhrase", userName + password);
+    }
+}
diff --git a/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/server/mysql/MySQLHasServerPlugin.java b/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/server/mysql/MySQLHasServerPlugin.java
new file mode 100644
index 0000000..7c58b21
--- /dev/null
+++ b/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/server/mysql/MySQLHasServerPlugin.java
@@ -0,0 +1,112 @@
+/**
+ * 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.has.plugins.server.mysql;
+
+import org.apache.commons.dbutils.DbUtils;
+import org.apache.kerby.has.server.AbstractHasServerPlugin;
+import org.apache.kerby.has.server.HasAuthenException;
+import org.apache.kerby.kerberos.kerb.type.base.AuthToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.ResultSet;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+
+public class MySQLHasServerPlugin extends AbstractHasServerPlugin {
+    private static final Logger LOG = LoggerFactory.getLogger(MySQLHasServerPlugin.class);
+
+     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getLoginType() {
+        return "MySQL";
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void doAuthenticate(AuthToken userToken, AuthToken authToken)
+        throws HasAuthenException {
+        String user = (String) userToken.getAttributes().get("user");
+        String secret = (String) userToken.getAttributes().get("secret");
+
+        String mysqlUrl = (String) userToken.getAttributes().get("mysqlUrl");
+        mysqlUrl = mysqlUrl.replace("jdbc:mysql:", "jdbc:mysql:thin:");
+        String mysqlUser = (String) userToken.getAttributes().get("mysqlUser");
+        String mysqlPasswd = (String) userToken.getAttributes().get("mysqlPasswd");
+        Connection connection = startConnection(mysqlUrl, mysqlUser, mysqlPasswd);
+
+        ResultSet res = null;
+        PreparedStatement preStm = null;
+        try {
+            String stm = "SELECT COUNT(*) FROM `has_user` WHERE user_name = ? AND pass_word = ?";
+            preStm = connection.prepareStatement(stm);
+            preStm.setString(1, user);
+            preStm.setString(2, secret);
+            res = preStm.executeQuery();
+            if (res.next() && res.getInt(1) > 0) {
+              LOG.debug("UserName: " + user);
+            } else {
+                LOG.error("Authentication failed.");
+                throw new HasAuthenException("Authentication failed.");
+            }
+        } catch (SQLException e) {
+            LOG.error("Failed.");
+            LOG.error("Error code: " + e.getErrorCode());
+            LOG.error("Error message: " + e.getMessage());
+            throw new HasAuthenException("Authentication failed." + e.getMessage());
+        } finally {
+            DbUtils.closeQuietly(preStm);
+            DbUtils.closeQuietly(res);
+            DbUtils.closeQuietly(connection);
+        }
+
+        authToken.setIssuer(userToken.getIssuer());
+        authToken.setSubject(user);
+        authToken.setExpirationTime(userToken.getExpiredTime());
+
+        authToken.addAttribute("userName", user);
+        authToken.addAttribute("passPhrase", user + secret);
+    }
+
+    /**
+     * Start the MySQL connection.
+     */
+    private Connection startConnection(String url, String user,
+                                       String password) throws HasAuthenException {
+        Connection connection;
+        try {
+            Class.forName("org.drizzle.jdbc.DrizzleDriver");
+            connection = DriverManager.getConnection(url, user, password);
+            if (!connection.isClosed()) {
+                LOG.info("Succeeded in connecting to MySQL.");
+            }
+        } catch (ClassNotFoundException e) {
+            throw new HasAuthenException("JDBC Driver Class not found. ", e);
+        } catch (SQLException e) {
+            throw new HasAuthenException("Failed to connecting to MySQL. ", e);
+        }
+
+        return connection;
+    }
+}
diff --git a/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.client.HasClientPlugin b/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.client.HasClientPlugin
new file mode 100644
index 0000000..cc3cac3
--- /dev/null
+++ b/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.client.HasClientPlugin
@@ -0,0 +1,16 @@
+# 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.
+
+org.apache.kerby.has.plugins.client.mysql.MySQLHasClientPlugin
diff --git a/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.server.HasServerPlugin b/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.server.HasServerPlugin
new file mode 100644
index 0000000..dfb9637
--- /dev/null
+++ b/has-project/has-plugins/src/main/resources/META-INF/services/org.apache.kerby.has.server.HasServerPlugin
@@ -0,0 +1,16 @@
+# 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.
+
+org.apache.kerby.has.plugins.server.mysql.MySQLHasServerPlugin
diff --git a/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasClientPluginRegistry.java b/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasClientPluginRegistry.java
new file mode 100644
index 0000000..55f0f70
--- /dev/null
+++ b/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasClientPluginRegistry.java
@@ -0,0 +1,44 @@
+/**
+ * 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.has.plugins;
+
+import org.apache.kerby.has.client.HasClientPluginRegistry;
+import org.apache.kerby.has.common.HasException;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Set;
+
+public class TestHasClientPluginRegistry {
+
+  @Test
+  public void testInit() {
+    Set<String> pluginsNames = HasClientPluginRegistry.registeredPlugins();
+    Assert.assertTrue(pluginsNames.size() > 0);
+  }
+
+  @Test
+  public void testCreatePlugin() throws HasException {
+    Assert.assertTrue(HasClientPluginRegistry.createPlugin("MySQL") != null);
+    Set<String> pluginNames = HasClientPluginRegistry.registeredPlugins();
+    for (String name : pluginNames) {
+      HasClientPluginRegistry.createPlugin(name);
+    }
+  }
+}
+
diff --git a/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasServerPluginRegistry.java b/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasServerPluginRegistry.java
new file mode 100644
index 0000000..d727b12
--- /dev/null
+++ b/has-project/has-plugins/src/test/java/org/apache/kerby/has/plugins/TestHasServerPluginRegistry.java
@@ -0,0 +1,43 @@
+/**
+ * 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.has.plugins;
+
+import org.apache.kerby.has.common.HasException;
+import org.apache.kerby.has.server.HasServerPluginRegistry;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Set;
+
+public class TestHasServerPluginRegistry {
+
+  @Test
+  public void testInit() {
+    Set<String> pluginsNames = HasServerPluginRegistry.registeredPlugins();
+    Assert.assertTrue(pluginsNames.size() > 0);
+  }
+
+  @Test
+  public void testCreatePlugin() throws HasException {
+    Assert.assertTrue(HasServerPluginRegistry.createPlugin("MySQL") != null);
+    Set<String> pluginNames = HasServerPluginRegistry.registeredPlugins();
+    for (String name : pluginNames) {
+      HasServerPluginRegistry.createPlugin(name);
+    }
+  }
+}
diff --git a/has-project/has-server/pom.xml b/has-project/has-server/pom.xml
index 9338981..624c464 100644
--- a/has-project/has-server/pom.xml
+++ b/has-project/has-server/pom.xml
@@ -6,7 +6,7 @@
   <parent>
     <artifactId>has-project</artifactId>
     <groupId>org.apache.kerby</groupId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/has-project/pom.xml b/has-project/pom.xml
index c7ccfb1..411767f 100644
--- a/has-project/pom.xml
+++ b/has-project/pom.xml
@@ -6,7 +6,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -18,7 +18,7 @@
     <module>has-common</module>
     <module>has-server</module>
     <module>has-client</module>
+    <module>has-plugins</module>
   </modules>
 
-
 </project>
\ No newline at end of file
diff --git a/kerby-backend/json-backend/pom.xml b/kerby-backend/json-backend/pom.xml
index 1882090..65792f4 100644
--- a/kerby-backend/json-backend/pom.xml
+++ b/kerby-backend/json-backend/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-backend</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>json-backend</artifactId>
diff --git a/kerby-backend/ldap-backend/pom.xml b/kerby-backend/ldap-backend/pom.xml
index 46c5574..f015281 100644
--- a/kerby-backend/ldap-backend/pom.xml
+++ b/kerby-backend/ldap-backend/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-backend</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>ldap-backend</artifactId>
diff --git a/kerby-backend/mavibot-backend/pom.xml b/kerby-backend/mavibot-backend/pom.xml
index cb8afcc..bf71d31 100644
--- a/kerby-backend/mavibot-backend/pom.xml
+++ b/kerby-backend/mavibot-backend/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-backend</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <artifactId>mavibot-backend</artifactId>
   <name>Mavibot based backend</name>
diff --git a/kerby-backend/mysql-backend/pom.xml b/kerby-backend/mysql-backend/pom.xml
index ad5a288..af008be 100644
--- a/kerby-backend/mysql-backend/pom.xml
+++ b/kerby-backend/mysql-backend/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-backend</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>mysql-backend</artifactId>
diff --git a/kerby-backend/pom.xml b/kerby-backend/pom.xml
index 6ce432c..13a13e1 100644
--- a/kerby-backend/pom.xml
+++ b/kerby-backend/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-backend</artifactId>
diff --git a/kerby-backend/zookeeper-backend/pom.xml b/kerby-backend/zookeeper-backend/pom.xml
index d8dbf9b..5eac144 100644
--- a/kerby-backend/zookeeper-backend/pom.xml
+++ b/kerby-backend/zookeeper-backend/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-backend</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>zookeeper-backend</artifactId>
diff --git a/kerby-common/kerby-asn1/pom.xml b/kerby-common/kerby-asn1/pom.xml
index 530d948..bf54dca 100644
--- a/kerby-common/kerby-asn1/pom.xml
+++ b/kerby-common/kerby-asn1/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-common</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/kerby-common/kerby-config/pom.xml b/kerby-common/kerby-config/pom.xml
index 911ec66..f0cdbc1 100644
--- a/kerby-common/kerby-config/pom.xml
+++ b/kerby-common/kerby-config/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-common</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/kerby-common/kerby-util/pom.xml b/kerby-common/kerby-util/pom.xml
index 1971e07..bf8a971 100644
--- a/kerby-common/kerby-util/pom.xml
+++ b/kerby-common/kerby-util/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-common</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-util</artifactId>
diff --git a/kerby-common/kerby-xdr/pom.xml b/kerby-common/kerby-xdr/pom.xml
index 6d0b925..c1ea7a0 100644
--- a/kerby-common/kerby-xdr/pom.xml
+++ b/kerby-common/kerby-xdr/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-common</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/kerby-common/pom.xml b/kerby-common/pom.xml
index f80d5a4..9051cbd 100644
--- a/kerby-common/pom.xml
+++ b/kerby-common/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   
   <artifactId>kerby-common</artifactId>
diff --git a/kerby-dist/has-dist/pom.xml b/kerby-dist/has-dist/pom.xml
index 48ca99f..882be35 100644
--- a/kerby-dist/has-dist/pom.xml
+++ b/kerby-dist/has-dist/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <artifactId>kerby-dist</artifactId>
     <groupId>org.apache.kerby</groupId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/kerby-dist/kdc-dist/LICENSE b/kerby-dist/kdc-dist/LICENSE
index aa7b845..a5f4f98 100644
--- a/kerby-dist/kdc-dist/LICENSE
+++ b/kerby-dist/kdc-dist/LICENSE
@@ -210,3 +210,8 @@
 
 See licenses/LICENSE-slf4j.txt
 
+===============================================================================
+This project bundles the JLine library (BSD license):
+
+See licenses/LICENSE.jline.txt
+
diff --git a/kerby-dist/kdc-dist/licenses/LICENSE.jline.txt b/kerby-dist/kdc-dist/licenses/LICENSE.jline.txt
new file mode 100644
index 0000000..4ebd976
--- /dev/null
+++ b/kerby-dist/kdc-dist/licenses/LICENSE.jline.txt
@@ -0,0 +1,35 @@
+Copyright (c) 2002-2017, the original author or authors.
+All rights reserved.
+
+http://www.opensource.org/licenses/bsd-license.php
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with
+the distribution.
+
+Neither the name of JLine nor the names of its contributors
+may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/kerby-dist/kdc-dist/pom.xml b/kerby-dist/kdc-dist/pom.xml
index ed48c91..ab17e45 100644
--- a/kerby-dist/kdc-dist/pom.xml
+++ b/kerby-dist/kdc-dist/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-dist</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kdc-dist</artifactId>
diff --git a/kerby-dist/pom.xml b/kerby-dist/pom.xml
index be09104..c6b73d7 100644
--- a/kerby-dist/pom.xml
+++ b/kerby-dist/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-dist</artifactId>
diff --git a/kerby-dist/tool-dist/pom.xml b/kerby-dist/tool-dist/pom.xml
index 5ed9d3d..c799a0c 100644
--- a/kerby-dist/tool-dist/pom.xml
+++ b/kerby-dist/tool-dist/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-dist</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>tool-dist</artifactId>
diff --git a/kerby-kdc-test/pom.xml b/kerby-kdc-test/pom.xml
index d2f41fa..5f36ed9 100644
--- a/kerby-kdc-test/pom.xml
+++ b/kerby-kdc-test/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-kdc-test</artifactId>
diff --git a/kerby-kdc/pom.xml b/kerby-kdc/pom.xml
index cb445b3..3f3f1a7 100644
--- a/kerby-kdc/pom.xml
+++ b/kerby-kdc/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-kdc</artifactId>
diff --git a/kerby-kerb/integration-test/pom.xml b/kerby-kerb/integration-test/pom.xml
index a685067..6d637d4 100644
--- a/kerby-kerb/integration-test/pom.xml
+++ b/kerby-kerb/integration-test/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>integration-test</artifactId>
diff --git a/kerby-kerb/kerb-admin-server/pom.xml b/kerby-kerb/kerb-admin-server/pom.xml
index e33c86e..6e41d7b 100644
--- a/kerby-kerb/kerb-admin-server/pom.xml
+++ b/kerby-kerb/kerb-admin-server/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-admin-server</artifactId>
diff --git a/kerby-kerb/kerb-admin/pom.xml b/kerby-kerb/kerb-admin/pom.xml
index b2f0aaa..bcfb7e0 100644
--- a/kerby-kerb/kerb-admin/pom.xml
+++ b/kerby-kerb/kerb-admin/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-admin</artifactId>
diff --git a/kerby-kerb/kerb-client-api-all/pom.xml b/kerby-kerb/kerb-client-api-all/pom.xml
index c8d89bf..6e837e0 100644
--- a/kerby-kerb/kerb-client-api-all/pom.xml
+++ b/kerby-kerb/kerb-client-api-all/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-client-api-all</artifactId>
diff --git a/kerby-kerb/kerb-client/pom.xml b/kerby-kerb/kerb-client/pom.xml
index fbf88cc..62bbd0a 100644
--- a/kerby-kerb/kerb-client/pom.xml
+++ b/kerby-kerb/kerb-client/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-client</artifactId>
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClientBase.java b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClientBase.java
index 602024a..08fd14f 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClientBase.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/KrbClientBase.java
@@ -271,15 +271,25 @@
      */
     public void storeTicket(SgtTicket sgtTicket, File ccacheFile) throws KrbException {
         LOG.info("Storing the sgt to the credential cache file.");
-        if (!ccacheFile.exists()) {
+        boolean createCache = !ccacheFile.exists() || ccacheFile.length() == 0;
+
+        if (createCache) {
             createCacheFile(ccacheFile);
         }
+
         if (ccacheFile.exists() && ccacheFile.canWrite()) {
-            CredentialCache cCache = new CredentialCache();
             try {
-                cCache.load(ccacheFile);
-                cCache.addCredential(new Credential(sgtTicket, sgtTicket.getClientPrincipal()));
-                cCache.setPrimaryPrincipal(sgtTicket.getClientPrincipal());
+                CredentialCache cCache;
+
+                if (!createCache) {
+                    cCache = new CredentialCache();
+                    cCache.load(ccacheFile);
+                    cCache.addCredential(new Credential(sgtTicket, sgtTicket.getClientPrincipal()));
+                } else {
+                    //Remind: contructor sets the cCache client principal from the sgtTicket one
+                    cCache = new CredentialCache(sgtTicket);
+                }
+
                 cCache.store(ccacheFile);
             } catch (IOException e) {
                 throw new KrbException("Failed to store sgt", e);
@@ -288,6 +298,7 @@
             throw new IllegalArgumentException("Invalid ccache file, "
                     + "not exist or writable: " + ccacheFile.getAbsolutePath());
         }
+
     }
 
     /**
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
index 8c8d6ed..113618e 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/impl/AbstractInternalKrbClient.java
@@ -152,14 +152,16 @@
         String serverPrincipalString = fixPrincipal(requestOptions.
                 getStringOption(KrbOption.SERVER_PRINCIPAL));
         PrincipalName serverPrincipalName = new PrincipalName(serverPrincipalString);
+        PrincipalName clientPrincipalName = null;
 
         if (tgtTicket != null) {
             String sourceRealm = tgtTicket.getRealm();
             String destRealm = serverPrincipalName.getRealm();
+            clientPrincipalName = tgtTicket.getClientPrincipal();
+
             if (!sourceRealm.equals(destRealm)) {
                 KrbConfig krbConfig = krbSetting.getKrbConfig();
                 LinkedList<String> capath = krbConfig.getCapath(sourceRealm, destRealm);
-                PrincipalName clientPrincipalName = tgtTicket.getClientPrincipal();
                 for (int i = 0; i < capath.size() - 1; i++) {
                     PrincipalName tgsPrincipalName = KrbUtil.makeTgsPrincipal(
                         capath.get(i), capath.get(i + 1));
@@ -170,11 +172,25 @@
                     tgsRequest = new TgsRequestWithTgt(context, sgtTicket);
                 }
             }
+
+        } else {
+            //This code is for the no-tgt case but works only with CLIENT_PRINCIPAL option
+            //Should be expanded later to encompass more use-cases
+            String clientPrincipalString = (String) requestOptions.getOptionValue(KrbOption.CLIENT_PRINCIPAL);
+            if (clientPrincipalString != null) {
+                clientPrincipalName = new PrincipalName(clientPrincipalString);
+            }
         }
 
         tgsRequest.setServerPrincipal(serverPrincipalName);
         tgsRequest.setRequestOptions(requestOptions);
-        return doRequestSgt(tgsRequest);
+        SgtTicket sgtTicket = doRequestSgt(tgsRequest);
+
+        if (clientPrincipalName != null) {
+            sgtTicket.setClientPrincipal(clientPrincipalName);
+        }
+
+        return sgtTicket;
     }
 
     protected abstract TgtTicket doRequestTgt(
diff --git a/kerby-kerb/kerb-common/pom.xml b/kerby-kerb/kerb-common/pom.xml
index e3ddc3a..10ac7f8 100644
--- a/kerby-kerb/kerb-common/pom.xml
+++ b/kerby-kerb/kerb-common/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-common</artifactId>
diff --git a/kerby-kerb/kerb-core/pom.xml b/kerby-kerb/kerb-core/pom.xml
index 8e67f48..45ce9d8 100644
--- a/kerby-kerb/kerb-core/pom.xml
+++ b/kerby-kerb/kerb-core/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-core</artifactId>
diff --git a/kerby-kerb/kerb-crypto/pom.xml b/kerby-kerb/kerb-crypto/pom.xml
index 75e0efe..e52421e 100644
--- a/kerby-kerb/kerb-crypto/pom.xml
+++ b/kerby-kerb/kerb-crypto/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-crypto</artifactId>
diff --git a/kerby-kerb/kerb-gssapi/pom.xml b/kerby-kerb/kerb-gssapi/pom.xml
index 3cb27c1..cd05a99 100644
--- a/kerby-kerb/kerb-gssapi/pom.xml
+++ b/kerby-kerb/kerb-gssapi/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-gssapi</artifactId>
diff --git a/kerby-kerb/kerb-identity-test/pom.xml b/kerby-kerb/kerb-identity-test/pom.xml
index 4aa6b9e..5c9765e 100644
--- a/kerby-kerb/kerb-identity-test/pom.xml
+++ b/kerby-kerb/kerb-identity-test/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-identity-test</artifactId>
diff --git a/kerby-kerb/kerb-identity/pom.xml b/kerby-kerb/kerb-identity/pom.xml
index aa1478e..c918582 100644
--- a/kerby-kerb/kerb-identity/pom.xml
+++ b/kerby-kerb/kerb-identity/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-identity</artifactId>
diff --git a/kerby-kerb/kerb-kdc-test/pom.xml b/kerby-kerb/kerb-kdc-test/pom.xml
index 7ec5938..dc79caf 100644
--- a/kerby-kerb/kerb-kdc-test/pom.xml
+++ b/kerby-kerb/kerb-kdc-test/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-kdc-test</artifactId>
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/CacheFileTest.java b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/CacheFileTest.java
index ebc40db..d73d959 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/CacheFileTest.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/CacheFileTest.java
@@ -27,7 +27,6 @@
 import org.apache.kerby.kerberos.kerb.type.ticket.TgtTicket;
 import org.junit.Test;
 
-@org.junit.Ignore("See DIRKRB-692")
 public class CacheFileTest extends KdcTestBase {
 
     @Test
@@ -52,4 +51,4 @@
             t.printStackTrace();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/kerby-kerb/kerb-server-api-all/pom.xml b/kerby-kerb/kerb-server-api-all/pom.xml
index 67f89d4..8e8c8f6 100644
--- a/kerby-kerb/kerb-server-api-all/pom.xml
+++ b/kerby-kerb/kerb-server-api-all/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-server-api-all</artifactId>
diff --git a/kerby-kerb/kerb-server/pom.xml b/kerby-kerb/kerb-server/pom.xml
index 741c6ea..efede2c 100644
--- a/kerby-kerb/kerb-server/pom.xml
+++ b/kerby-kerb/kerb-server/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-server</artifactId>
diff --git a/kerby-kerb/kerb-simplekdc/pom.xml b/kerby-kerb/kerb-simplekdc/pom.xml
index 90f49d2..f4af013 100644
--- a/kerby-kerb/kerb-simplekdc/pom.xml
+++ b/kerby-kerb/kerb-simplekdc/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-simplekdc</artifactId>
diff --git a/kerby-kerb/kerb-util/pom.xml b/kerby-kerb/kerb-util/pom.xml
index f2dfff8..2786097 100644
--- a/kerby-kerb/kerb-util/pom.xml
+++ b/kerby-kerb/kerb-util/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-kerb</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerb-util</artifactId>
diff --git a/kerby-kerb/pom.xml b/kerby-kerb/pom.xml
index 12c4db2..97d50b5 100644
--- a/kerby-kerb/pom.xml
+++ b/kerby-kerb/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   
   <artifactId>kerby-kerb</artifactId>
diff --git a/kerby-pkix/pom.xml b/kerby-pkix/pom.xml
index c4020dc..cc4d58a 100644
--- a/kerby-pkix/pom.xml
+++ b/kerby-pkix/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/kerby-provider/pom.xml b/kerby-provider/pom.xml
index df47669..3faed57 100644
--- a/kerby-provider/pom.xml
+++ b/kerby-provider/pom.xml
@@ -16,7 +16,7 @@
   <parent>
     <artifactId>kerby-all</artifactId>
     <groupId>org.apache.kerby</groupId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/kerby-provider/token-provider/pom.xml b/kerby-provider/token-provider/pom.xml
index db3cece..cfabca6 100644
--- a/kerby-provider/token-provider/pom.xml
+++ b/kerby-provider/token-provider/pom.xml
@@ -16,7 +16,7 @@
   <parent>
     <artifactId>kerby-provider</artifactId>
     <groupId>org.apache.kerby</groupId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/kerby-tool/client-tool/pom.xml b/kerby-tool/client-tool/pom.xml
index 892c46f..052cb9a 100644
--- a/kerby-tool/client-tool/pom.xml
+++ b/kerby-tool/client-tool/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-tool</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>client-tool</artifactId>
diff --git a/kerby-tool/kdc-tool/pom.xml b/kerby-tool/kdc-tool/pom.xml
index 009026c..69ab83d 100644
--- a/kerby-tool/kdc-tool/pom.xml
+++ b/kerby-tool/kdc-tool/pom.xml
@@ -18,7 +18,7 @@
     <parent>
       <groupId>org.apache.kerby</groupId>
       <artifactId>kerby-tool</artifactId>
-      <version>1.1.1-SNAPSHOT</version>
+      <version>2.0.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>kdc-tool</artifactId>
@@ -56,6 +56,11 @@
         <artifactId>kerb-admin-server</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.jline</groupId>
+        <artifactId>jline</artifactId>
+        <version>${jline.version}</version>
+      </dependency>
 
     </dependencies>
 
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
index bc3b2e1..82f49b9 100644
--- a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/KadminTool.java
@@ -36,6 +36,14 @@
 import org.apache.kerby.kerberos.tool.kadmin.command.RenamePrincipalCommand;
 import org.apache.kerby.kerberos.tool.kadmin.command.AddPrincipalsCommand;
 import org.apache.kerby.util.OSUtil;
+import org.jline.reader.Completer;
+import org.jline.reader.EndOfFileException;
+import org.jline.reader.LineReader;
+import org.jline.reader.LineReaderBuilder;
+import org.jline.reader.UserInterruptException;
+import org.jline.reader.impl.completer.StringsCompleter;
+import org.jline.terminal.Terminal;
+import org.jline.terminal.TerminalBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +51,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Map;
-import java.util.Scanner;
 
 /**
  * Ref. MIT kadmin command tool usage.
@@ -185,7 +192,7 @@
         return confDir;
     }
 
-    public static void main(String[] args) throws KrbException {
+    public static void main(String[] args) throws KrbException, IOException {
 
         if (args.length < 2) {
             System.err.println(USAGE);
@@ -249,16 +256,23 @@
             String query = kOptions.getStringOption(KadminOption.QUERY);
             execute(kadmin, query);
         } else {
-            System.out.print(PROMPT + ": ");
 
-            try (Scanner scanner = new Scanner(System.in, "UTF-8")) {
-                String input = scanner.nextLine();
+            Completer completer = new StringsCompleter("add_principal", "batch_anks", "ktadd", "ktremove",
+                                                       "delete_principal", "modify_principal", "rename_principal",
+                                                       "change_password", "list_principals", "get_principal");
 
-                while (!(input.equals("quit") || input.equals("exit")
-                        || input.equals("q"))) {
-                    execute(kadmin, input);
-                    System.out.print(PROMPT + ": ");
-                    input = scanner.nextLine();
+            Terminal terminal = TerminalBuilder.terminal();
+            LineReader lineReader = LineReaderBuilder.builder().completer(completer).terminal(terminal).build();
+
+            while (true) {
+                try {
+                    String line = lineReader.readLine(PROMPT + ": ");
+                    if ("quit".equals(line) || "exit".equals(line) || "q".equals(line)) {
+                        break;
+                    }
+                    execute(kadmin, line);
+                } catch (UserInterruptException | EndOfFileException ex) {
+                    break;
                 }
             }
         }
diff --git a/kerby-tool/pom.xml b/kerby-tool/pom.xml
index f3f9be3..4fd24d3 100644
--- a/kerby-tool/pom.xml
+++ b/kerby-tool/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <groupId>org.apache.kerby</groupId>
     <artifactId>kerby-all</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>kerby-tool</artifactId>
diff --git a/pom.xml b/pom.xml
index 5242602..9029972 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
   <groupId>org.apache.kerby</groupId>
   <artifactId>kerby-all</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>2.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <name>Apache Kerby Project</name>
@@ -36,7 +36,7 @@
     <connection>scm:git:https://git-wip-us.apache.org/repos/asf/directory-kerby.git</connection>
     <url>https://github.com/apache/directory-kerby</url>
     <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/directory-kerby.git</developerConnection>
-    <tag>kerby-all-1.1.0-SNAPSHOT</tag>
+    <tag>kerby-all-2.0.0-SNAPSHOT</tag>
   </scm>
 
   <distributionManagement>
@@ -59,6 +59,7 @@
     <findbugs.version>3.0.4</findbugs.version>
     <buildtools.dir>${basedir}/build-tools</buildtools.dir>
     <skipTests>false</skipTests>
+    <jline.version>3.6.0</jline.version>
     <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
     <maven-jxr-plugin.version>2.5</maven-jxr-plugin.version>
     <mockito.version>2.7.22</mockito.version>