Package uk.ac.starlink.auth
Interface ContextFactory
public interface ContextFactory
Contains configuration for creating AuthContext objects from
user credentials.
- Since:
- 15 Jun 2020
- Author:
- Mark Taylor
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAttempts to create an authentication context, by enquiring for input from the UI as appropriate.Creates a context representing unauthenticated (anonymous) access.
-
Method Details
-
createContext
Attempts to create an authentication context, by enquiring for input from the UI as appropriate. Should return an apparently viable, though not guaranteed valid, context (AuthContext.hasCredentials()
will return true), or null if the user declined to authenticate.If appropriate, the implementation of this method should offer the user retry attempts following failed or inadequate credential entry in accordance with the supplied UserInterface. Note however that retries must not be attempted if
UserInterface.canRetry()
returns false or following a null return fromUserInterface.readUserPassword(java.lang.String[])
.- Parameters:
ui
- user interface that can be used to query the user for credentials- Returns:
- authentication context, or null if the user declined to authenticate
-
createUnauthContext
AuthContext createUnauthContext()Creates a context representing unauthenticated (anonymous) access. The resulting context, for whichAuthContext.hasCredentials()
will return false, may or may not be capable of connecting, but it can represent the choice of a user not to authenticate for a given challenge.- Returns:
- anonymous authentication context
-