public class JCEKSPasswordAliasStore extends Object implements PasswordAliasStore
The keystore is actually managed by the PasswordAdapter, to which this implementation currently delegates its work.
Note that this service is currently per-lookup. This is so that each use of the alias store gets the current on-disk information. Ideally we can change this when we can use Java 7 features, including the WatchService feature.
This class's methods are not synchronized because the PasswordAdapter's methods are. If this implementation changes so that it no longer delegates to those synchronized PasswordAdapter methods, then make sure that the implementation is thread-safe.
Note that the domain-scoped password alias store service class extends this class. As a service, that class will be instantiated using the no-args constructor. So the actual initialization of the class occurs in the init method. The domain-scoped service class invokes the init method itself. Any code that needs to create some other alias store can use the newInstance method to provide the location of the alias store file and the password.
| Constructor and Description |
|---|
JCEKSPasswordAliasStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Deletes all password aliases from the store.
|
boolean |
containsKey(String alias)
Reports whether the store contains the specified alias.
|
char[] |
get(String alias)
Returns the password associated with the specified alias.
|
protected void |
init(String pathToAliasStore,
char[] storePassword) |
boolean |
isEmpty()
Reports whether the alias store is empty.
|
Iterator<String> |
keys()
Returns an Iterator over aliases present in the alias store.
|
static JCEKSPasswordAliasStore |
newInstance(String pathToAliasStore,
char[] storePassword) |
void |
put(String alias,
char[] password)
Insert a new alias with the specified password, or assigns a new
password to an existing alias.
|
void |
putAll(Map<String,char[]> settings)
Adds a group of alias/password pairs in a single operation.
|
void |
putAll(PasswordAliasStore otherStore)
Adds all alias/password pairs from the specified store to this store.
|
void |
remove(String alias)
Removes the specified alias (and the associated password) from the
password alias store.
|
int |
size()
Reports the number of aliases present in the store.
|
protected final void init(String pathToAliasStore, char[] storePassword)
public static JCEKSPasswordAliasStore newInstance(String pathToAliasStore, char[] storePassword)
public void clear()
PasswordAliasStoreclear in interface PasswordAliasStorepublic void put(String alias, char[] password)
PasswordAliasStoreput in interface PasswordAliasStorealias - the alias to create or reassignpassword - the password to be associated with the aliaspublic void putAll(PasswordAliasStore otherStore)
PasswordAliasStoreputAll in interface PasswordAliasStoreotherStore - the alias store from which to get entriespublic void putAll(Map<String,char[]> settings)
PasswordAliasStoreCallers might prefer to invoke this method once rather than invoking {@link #put ) repeatedly, for example if an implementation persists each change as it is made.
putAll in interface PasswordAliasStoresettings - the alias/password pairs to addpublic void remove(String alias)
PasswordAliasStoreremove in interface PasswordAliasStorealias - the alias to be removedpublic boolean containsKey(String alias)
PasswordAliasStorecontainsKey in interface PasswordAliasStorealias - the alias to check forpublic char[] get(String alias)
PasswordAliasStoreget in interface PasswordAliasStorealias - the alias of interestpublic boolean isEmpty()
PasswordAliasStoreisEmpty in interface PasswordAliasStorepublic Iterator<String> keys()
PasswordAliasStorekeys in interface PasswordAliasStorepublic int size()
PasswordAliasStoresize in interface PasswordAliasStoreCopyright © 2017. All rights reserved.