Skip to content

Commit

Permalink
Replace IPasswordStore with PasswordStore
Browse files Browse the repository at this point in the history
The PasswordStore has been added to replace IPasswordStore.
The IPasswordStore has been deprecated and will be removed
in the future.
  • Loading branch information
edewata committed May 10, 2024
1 parent a1533e4 commit f99e10a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 21 deletions.
6 changes: 6 additions & 0 deletions docs/changes/v5.6.0/API-Changes.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= API Changes =

== Deprecate IPasswordStore ==

The `org.dogtagpki.jss.tomcat.IPasswordStore` has been deprecated.
Use `org.dogtagpki.jss.tomcat.PasswordStore` instead.
21 changes: 5 additions & 16 deletions tomcat/src/main/java/org/dogtagpki/jss/tomcat/IPasswordStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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 {
}
38 changes: 38 additions & 0 deletions tomcat/src/main/java/org/dogtagpki/jss/tomcat/PasswordStore.java
Original file line number Diff line number Diff line change
@@ -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<String> getTags();

public Object putPassword(String tag, String password);

public void commit() throws IOException, ClassCastException,
NullPointerException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions tomcat/src/main/java/org/dogtagpki/jss/tomcat/TomcatJSS.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class TomcatJSS implements SSLSocketListener {

String passwordClass;
String passwordFile;
IPasswordStore passwordStore;
PasswordStore passwordStore;

String serverCertNickFile;
String serverCertNick;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f99e10a

Please sign in to comment.