Interface PasswordIdentityProvider
-
- All Known Subinterfaces:
AuthenticationIdentitiesProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface PasswordIdentityProvider
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static PasswordIdentityProvider
EMPTY_PASSWORDS_PROVIDER
An "empty" implementation ofPasswordIdentityProvider
that returns an empty group of passwords
-
Method Summary
-
-
-
Field Detail
-
EMPTY_PASSWORDS_PROVIDER
static final PasswordIdentityProvider EMPTY_PASSWORDS_PROVIDER
An "empty" implementation ofPasswordIdentityProvider
that returns an empty group of passwords
-
-
Method Detail
-
loadPasswords
Iterable<String> loadPasswords(SessionContext session) throws IOException, GeneralSecurityException
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).- Returns:
- The currently available passwords - ignored if
null
- Throws:
IOException
- If failed to load the passwordsGeneralSecurityException
- If some security issue with the passwords
-
iteratorOf
static Iterator<String> iteratorOf(SessionContext session, PasswordIdentityProvider identities, PasswordIdentityProvider passwords) throws IOException, GeneralSecurityException
Creates a "unified"Iterator
of passwords out of 2 possiblePasswordIdentityProvider
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).identities
- The registered passwordspasswords
- Extra available passwords- Returns:
- The wrapping iterator
- Throws:
IOException
- If failed to load the passwordsGeneralSecurityException
- If some security issue with the passwords- See Also:
resolvePasswordIdentityProvider(SessionContext, PasswordIdentityProvider, PasswordIdentityProvider)
-
iteratorOf
static Iterator<String> iteratorOf(SessionContext session, PasswordIdentityProvider provider) throws IOException, GeneralSecurityException
Resolves a non-null
iterator of the available passwords- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).provider
- ThePasswordIdentityProvider
- ignored ifnull
(i.e., return an empty iterator)- Returns:
- A non-
null
iterator - which may be empty if no provider or no passwords - Throws:
IOException
- If failed to load the passwordsGeneralSecurityException
- If some security issue with the passwords
-
resolvePasswordIdentityProvider
static PasswordIdentityProvider resolvePasswordIdentityProvider(SessionContext session, PasswordIdentityProvider identities, PasswordIdentityProvider passwords)
Creates a "unified"
PasswordIdentityProvider
out of 2 possible ones as follows:- If both are
null
then returnnull
. - If either one is
null
then use the non-null
one. - If both are the same instance then use it.
- Otherwise, returns a wrapper that groups both providers.
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).identities
- The registered passwordspasswords
- The extra available passwords- Returns:
- The resolved provider
- See Also:
multiProvider(SessionContext, PasswordIdentityProvider...)
- If both are
-
multiProvider
static PasswordIdentityProvider multiProvider(SessionContext session, PasswordIdentityProvider... providers)
Wraps a group ofPasswordIdentityProvider
into a single one- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).providers
- The providers - ignored ifnull
/empty (i.e., returnsEMPTY_PASSWORDS_PROVIDER
- Returns:
- The wrapping provider
- See Also:
multiProvider(SessionContext, Collection)
-
multiProvider
static PasswordIdentityProvider multiProvider(SessionContext session, Collection<? extends PasswordIdentityProvider> providers)
Wraps a group ofPasswordIdentityProvider
into a single one- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).providers
- The providers - ignored ifnull
/empty (i.e., returnsEMPTY_PASSWORDS_PROVIDER
- Returns:
- The wrapping provider
-
iterableOf
static Iterable<String> iterableOf(SessionContext session, Collection<? extends PasswordIdentityProvider> providers)
Wraps a group ofPasswordIdentityProvider
into anIterable
of their combined passwords- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).providers
- The providers - ignored ifnull
/empty (i.e., returns an empty iterable instance)- Returns:
- The wrapping iterable
-
wrapPasswords
static PasswordIdentityProvider wrapPasswords(String... passwords)
Wraps a group of passwords into aPasswordIdentityProvider
- Parameters:
passwords
- The passwords - ignored ifnull
/empty (i.e., returnsEMPTY_PASSWORDS_PROVIDER
)- Returns:
- The provider wrapper
-
wrapPasswords
static PasswordIdentityProvider wrapPasswords(Iterable<String> passwords)
Wraps a group of passwords into aPasswordIdentityProvider
- Parameters:
passwords
- The passwordsIterable
- ignored ifnull
(i.e., returnsEMPTY_PASSWORDS_PROVIDER
)- Returns:
- The provider wrapper
-
-