K - The type of the keys.@ThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class PromptingKeyProvider<K extends SafeKey<K>> extends SafeKeyProvider<K>
PromptingKeyProvider.View interface.
The view may then display the resource URI by calling getResource()
on this instance and set the key by using the given PromptingKeyProvider.Controller.PromptingKeyManager| Modifier and Type | Class and Description |
|---|---|
private class |
PromptingKeyProvider.BaseController
Proxies access to the secret key for
PromptingKeyProvider.View implementations. |
static interface |
PromptingKeyProvider.Controller<K extends SafeKey<K>>
Proxies access to the key for
PromptingKeyProvider.View implementations. |
private class |
PromptingKeyProvider.ReadController
The controller to use when promting for a secret key to decrypt a
protected resource.
|
private static class |
PromptingKeyProvider.State
Implements the behavior strategy of its enclosing class.
|
static interface |
PromptingKeyProvider.View<K extends SafeKey<K>>
Used for the actual prompting of the user for a key (a password for
example) which is required to access a protected resource.
|
private class |
PromptingKeyProvider.WriteController
The controller to use when promting for a secret key to encrypt a
protected resource.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
changeRequested |
private CacheableUnknownKeyException |
exception |
private PromptingKeyManager<K> |
manager |
private URI |
resource
The resource identifier for the protected resource.
|
private PromptingKeyProvider.State |
state |
MIN_KEY_RETRY_DELAY| Constructor and Description |
|---|
PromptingKeyProvider(PromptingKeyManager<K> manager) |
| Modifier and Type | Method and Description |
|---|---|
private CacheableUnknownKeyException |
getException() |
protected K |
getKey() |
private K |
getKey0() |
URI |
getResource()
Returns the unique resource identifier (resource ID) of the protected
resource for which this key provider is used.
|
private PromptingKeyProvider.State |
getState() |
private PromptingKeyProvider.View<K> |
getView() |
private boolean |
isChangeRequested()
Returns whether or not the user shall get prompted for a new key upon
the next call to
SafeKeyProvider.getWriteKey(), provided that the key
has been set before. |
private void |
reset() |
void |
resetCancelledKey()
Resets the state of this key provider, its current key and the value of
its
changeRequested property
if and only if prompting for a key has been cancelled. |
void |
resetUnconditionally()
Resets the state of this key provider, its current key and the value of
its
changeRequested property
unconditionally. |
protected void |
retrieveReadKey(boolean invalid)
Retrieves the secret key for the decryption of a protected resource.
|
protected void |
retrieveWriteKey()
Retrieves the secret key for the encryption of a protected resource.
|
private void |
setChangeRequested(boolean changeRequested) |
private void |
setException(CacheableUnknownKeyException exception) |
void |
setKey(K key)
Sets the secret key programmatically.
|
private void |
setKey0(K key) |
(package private) void |
setResource(URI resource)
Returns the unique resource identifier (resource ID) of the protected
resource for which this key provider is used.
|
private void |
setState(PromptingKeyProvider.State state) |
getReadKey, getWriteKeyprivate volatile boolean changeRequested
@CheckForNull private volatile CacheableUnknownKeyException exception
private final PromptingKeyManager<K extends SafeKey<K>> manager
@CheckForNull private volatile URI resource
private volatile PromptingKeyProvider.State state
PromptingKeyProvider(PromptingKeyManager<K> manager)
@CheckForNull private CacheableUnknownKeyException getException()
@CheckForNull private K getKey0()
@CheckForNull public URI getResource()
null.private PromptingKeyProvider.State getState()
private PromptingKeyProvider.View<K> getView()
private boolean isChangeRequested()
SafeKeyProvider.getWriteKey(), provided that the key
has been set before.SafeKeyProvider.getWriteKey(), provided that the key
has been set before.private void reset()
public void resetCancelledKey()
changeRequested property
if and only if prompting for a key has been cancelled.public void resetUnconditionally()
changeRequested property
unconditionally.protected void retrieveReadKey(boolean invalid)
throws UnknownKeyException
SafeKeyProviderSubsequent calls to this method may return the same object.
retrieveReadKey in class SafeKeyProvider<K extends SafeKey<K>>UnknownKeyException - If the secret key is unknown.
At the subclasses discretion, this may mean that prompting for
the key has been disabled or cancelled by the user.SafeKeyProvider.getReadKey(boolean)protected void retrieveWriteKey()
throws UnknownKeyException
SafeKeyProviderSubsequent calls to this method may return the same object.
retrieveWriteKey in class SafeKeyProvider<K extends SafeKey<K>>UnknownKeyException - If the secret key is unknown.
At the subclasses discretion, this may mean that prompting for
the key has been disabled or cancelled by the user.SafeKeyProvider.getWriteKey()private void setChangeRequested(boolean changeRequested)
private void setException(@CheckForNull CacheableUnknownKeyException exception)
public void setKey(@CheckForNull K key)
KeyProviderKeyProvider.getReadKey(boolean) in order to update
some properties of the secret key after it has been validated by the
client.
Implementations should make a protective copy of the given key in order to protect against subsequent modifications by the client.
setKey in interface KeyProvider<K extends SafeKey<K>>setKey in class SafeKeyProvider<K extends SafeKey<K>>key - the secret key.
If this is null, this key provider is set to a state
as if prompting for the secret key had been cancelled.private void setKey0(@CheckForNull K key)
void setResource(@CheckForNull URI resource)
null.private void setState(PromptingKeyProvider.State state)
Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.