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 PasswordIdentityProviderEMPTY_PASSWORDS_PROVIDERAn "empty" implementation ofPasswordIdentityProviderthat returns an empty group of passwords
-
Method Summary
-
-
-
Field Detail
-
EMPTY_PASSWORDS_PROVIDER
static final PasswordIdentityProvider EMPTY_PASSWORDS_PROVIDER
An "empty" implementation ofPasswordIdentityProviderthat returns an empty group of passwords
-
-
Method Detail
-
loadPasswords
Iterable<String> loadPasswords(SessionContext session) throws IOException, GeneralSecurityException
- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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"Iteratorof passwords out of 2 possiblePasswordIdentityProvider- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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-nulliterator of the available passwords- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool).provider- ThePasswordIdentityProvider- ignored ifnull(i.e., return an empty iterator)- Returns:
- A non-
nulliterator - 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"
PasswordIdentityProviderout of 2 possible ones as follows:- If both are
nullthen returnnull. - If either one is
nullthen use the non-nullone. - If both are the same instance then use it.
- Otherwise, returns a wrapper that groups both providers.
- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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 ofPasswordIdentityProviderinto a single one- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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 ofPasswordIdentityProviderinto a single one- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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 ofPasswordIdentityProviderinto anIterableof their combined passwords- Parameters:
session- TheSessionContextfor invoking this load command - may benullif 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
-
-