From f99e10a5f5beba2c5f35fe16b5a7242046916e0d Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Fri, 10 May 2024 11:03:57 -0500 Subject: [PATCH] Replace IPasswordStore with PasswordStore The PasswordStore has been added to replace IPasswordStore. The IPasswordStore has been deprecated and will be removed in the future. --- docs/changes/v5.6.0/API-Changes.adoc | 6 +++ .../dogtagpki/jss/tomcat/IPasswordStore.java | 21 +++------- .../dogtagpki/jss/tomcat/PasswordStore.java | 38 +++++++++++++++++++ .../jss/tomcat/PlainPasswordFile.java | 2 +- .../org/dogtagpki/jss/tomcat/TomcatJSS.java | 8 ++-- 5 files changed, 54 insertions(+), 21 deletions(-) create mode 100644 docs/changes/v5.6.0/API-Changes.adoc create mode 100644 tomcat/src/main/java/org/dogtagpki/jss/tomcat/PasswordStore.java diff --git a/docs/changes/v5.6.0/API-Changes.adoc b/docs/changes/v5.6.0/API-Changes.adoc new file mode 100644 index 000000000..57a27f1b5 --- /dev/null +++ b/docs/changes/v5.6.0/API-Changes.adoc @@ -0,0 +1,6 @@ += API Changes = + +== Deprecate IPasswordStore == + +The `org.dogtagpki.jss.tomcat.IPasswordStore` has been deprecated. +Use `org.dogtagpki.jss.tomcat.PasswordStore` instead. diff --git a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/IPasswordStore.java b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/IPasswordStore.java index bfaf32c87..00f805a9b 100644 --- a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/IPasswordStore.java +++ b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/IPasswordStore.java @@ -19,20 +19,9 @@ package org.dogtagpki.jss.tomcat; -import java.io.IOException; -import java.util.Enumeration; - -public interface IPasswordStore { - public void init(String pwdPath) throws IOException; - - public String getPassword(String tag, int iteration); - - public String getPassword(String tag); - - public Enumeration getTags(); - - public Object putPassword(String tag, String password); - - public void commit() throws IOException, ClassCastException, - NullPointerException; +/** + * @deprecated Use org.dogtagpki.jss.tomcat.PasswordStore instead. + */ +@Deprecated(since="5.6.0", forRemoval=true) +public interface IPasswordStore extends PasswordStore { } diff --git a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PasswordStore.java b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PasswordStore.java new file mode 100644 index 000000000..8657ecb4d --- /dev/null +++ b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PasswordStore.java @@ -0,0 +1,38 @@ +/* BEGIN COPYRIGHT BLOCK + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Copyright (C) 2007 Red Hat, Inc. + * All rights reserved. + * END COPYRIGHT BLOCK */ + +package org.dogtagpki.jss.tomcat; + +import java.io.IOException; +import java.util.Enumeration; + +public interface PasswordStore { + public void init(String pwdPath) throws IOException; + + public String getPassword(String tag, int iteration); + + public String getPassword(String tag); + + public Enumeration getTags(); + + public Object putPassword(String tag, String password); + + public void commit() throws IOException, ClassCastException, + NullPointerException; +} diff --git a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PlainPasswordFile.java b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PlainPasswordFile.java index a15e41713..4ab486086 100644 --- a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PlainPasswordFile.java +++ b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/PlainPasswordFile.java @@ -29,7 +29,7 @@ import java.util.Enumeration; import java.util.Properties; -public class PlainPasswordFile implements IPasswordStore { +public class PlainPasswordFile implements PasswordStore { private String mPwdPath = ""; private Properties mPwdStore; private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PlainPasswordFile.class); diff --git a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/TomcatJSS.java b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/TomcatJSS.java index 4e63e9687..b2c280ff7 100644 --- a/tomcat/src/main/java/org/dogtagpki/jss/tomcat/TomcatJSS.java +++ b/tomcat/src/main/java/org/dogtagpki/jss/tomcat/TomcatJSS.java @@ -79,7 +79,7 @@ public class TomcatJSS implements SSLSocketListener { String passwordClass; String passwordFile; - IPasswordStore passwordStore; + PasswordStore passwordStore; String serverCertNickFile; String serverCertNick; @@ -147,11 +147,11 @@ public String getServerCertNickFile() { return serverCertNickFile; } - public IPasswordStore getPasswordStore() { + public PasswordStore getPasswordStore() { return passwordStore; } - public void setPasswordStore(IPasswordStore passwordStore) { + public void setPasswordStore(PasswordStore passwordStore) { this.passwordStore = passwordStore; } @@ -451,7 +451,7 @@ public void init() throws KeyDatabaseException, CertDatabaseException, GeneralSe manager = CryptoManager.getInstance(); - passwordStore = (IPasswordStore) Class.forName(passwordClass).getDeclaredConstructor().newInstance(); + passwordStore = (PasswordStore) Class.forName(passwordClass).getDeclaredConstructor().newInstance(); passwordStore.init(passwordFile); login();