K
- The type of the keys.@ThreadSafe 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 |
---|---|
static interface |
PromptingKeyProvider.Controller<K extends SafeKey<K>>
Proxies access to the key for
PromptingKeyProvider.View implementations. |
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.
|
MIN_KEY_RETRY_DELAY
Modifier and Type | Method and Description |
---|---|
protected K |
getKey() |
URI |
getResource()
Returns the unique resource identifier (resource ID) of the protected
resource for which this key provider is used.
|
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.
|
void |
setKey(K key)
Sets the secret key programmatically.
|
getReadKey, getWriteKey
@CheckForNull public URI getResource()
null
.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
SafeKeyProvider
Subsequent 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
SafeKeyProvider
Subsequent 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()
public void setKey(@CheckForNull K key)
KeyProvider
KeyProvider.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.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.