public interface MasterPasswordProvider
A typical implementation of this class would pop up a dialog to ask the user
for the master password. Such providers should check
GraphicsEnvironment#isHeadless()
before returning, to avoid attempts
to pop up dialogues on server/headless installations.
Another example may be to read the master password from a file or from command line parameters.
CredentialManager
Modifier and Type | Interface and Description |
---|---|
static class |
MasterPasswordProvider.ProviderComparator
Set the provider's priority that determines the order in which various
master password providers will be invoked.
|
Modifier and Type | Method and Description |
---|---|
String |
getMasterPassword(boolean firstTime)
Get the master password for the Credential Manager.
|
int |
getProviderPriority()
Get the priority of this provider.
|
void |
setMasterPassword(String password)
Set the master password.
|
String getMasterPassword(boolean firstTime)
This method will only be called if the provider returned
true
from #canProvideMasterPassword()
.
If the parameter firstTime
is true
, this is a
request for setting the master password, as the Keystore and
Truststore have not been created yet.
firstTime
- true
if this is the first time the keystore is
accessed, in which case the returned password will be used to
encrypt the keystore. If false
, the returned
password will be used to decrypt (unlock) the keystore.null
if not available (user
cancelled, etc.)#canProvideMasterPassword()
void setMasterPassword(String password)
password
- to setint getProviderPriority()
The providers with highest priority will be asked first, lower-priority
providers will be asked only if the higher ones either return
false
on the canProvideMasterPassword() method, or return
null
on the corresponding actual request.
It is undetermined who will be asked first if providers have the same priority.
A typical priority for UI providers that pop up a dialog to as the user
could be 100
, allowing server-side providers to override
with priorities like 500
, or fall-back providers (say by
reading system properties) to have a priority of 10
.
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.