@FunctionalInterface public interface FilePasswordProvider
| Modifier and Type | Interface and Description |
|---|---|
static interface |
FilePasswordProvider.Decoder<T>
Something that can produce a result given a password.
|
static class |
FilePasswordProvider.ResourceDecodeResult |
| Modifier and Type | Field and Description |
|---|---|
static FilePasswordProvider |
EMPTY
An "empty" provider that returns
null - i.e., unprotected key file |
| Modifier and Type | Method and Description |
|---|---|
default <T> T |
decode(SessionContext session,
NamedResource resourceKey,
FilePasswordProvider.Decoder<? extends T> decoder)
Obtains the password through
getPassword(SessionContext, NamedResource, int), invokes the
FilePasswordProvider.Decoder and then
handleDecodeAttemptResult(SessionContext, NamedResource, int, String, Exception) and then returns the
decoded result. |
String |
getPassword(SessionContext session,
NamedResource resourceKey,
int retryIndex) |
default FilePasswordProvider.ResourceDecodeResult |
handleDecodeAttemptResult(SessionContext session,
NamedResource resourceKey,
int retryIndex,
String password,
Exception err)
Invoked to inform the password provide about the decoding result.
|
static FilePasswordProvider |
of(String password) |
static final FilePasswordProvider EMPTY
null - i.e., unprotected key fileString getPassword(SessionContext session, NamedResource resourceKey, int retryIndex) throws IOException
session - The SessionContext for invoking this load command - may be null if not
invoked within a session context (e.g., offline tool or session unknown).resourceKey - The resource key representing the private fileretryIndex - The zero-based index of the invocation for the specific resource (in case invoked several
times for the same resource)null/empty then no password is requiredIOException - if cannot resolve passwordhandleDecodeAttemptResult(SessionContext, NamedResource, int, String, Exception)default FilePasswordProvider.ResourceDecodeResult handleDecodeAttemptResult(SessionContext session, NamedResource resourceKey, int retryIndex, String password, Exception err) throws IOException, GeneralSecurityException
session - The SessionContext for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey - The resource key representing the private fileretryIndex - The zero-based index of the invocation for the specific resource (in case
invoked several times for the same resource). If success report, it indicates
the number of retries it took to succeedpassword - The password that was attemptederr - The attempt result - null for successnull is same as
FilePasswordProvider.ResourceDecodeResult.TERMINATE.IOException - If cannot resolve a new passwordGeneralSecurityException - If not attempting to resolve a new passworddefault <T> T decode(SessionContext session, NamedResource resourceKey, FilePasswordProvider.Decoder<? extends T> decoder) throws IOException, GeneralSecurityException
getPassword(SessionContext, NamedResource, int), invokes the
FilePasswordProvider.Decoder and then
handleDecodeAttemptResult(SessionContext, NamedResource, int, String, Exception) and then returns the
decoded result. If the decoder fails and the FilePasswordProvider.ResourceDecodeResult is FilePasswordProvider.ResourceDecodeResult.RETRY,
the whole process is re-tried.T - Result type of the decodersession - SessionContext, may be nullresourceKey - NamedResource used for error reportingdecoder - FilePasswordProvider.Decoder to produce the result given a passwordnull if noneIOException - if an I/O problem occursGeneralSecurityException - if the decoder throws itstatic FilePasswordProvider of(String password)
Copyright © 2018–2024 The Apache Software Foundation. All rights reserved.