Package org.openstreetmap.josm.io.auth
Class AbstractCredentialsAgent
java.lang.Object
org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
- All Implemented Interfaces:
CredentialsAgent
- Direct Known Subclasses:
JosmPreferencesCredentialAgent
Partial implementation of the
CredentialsAgent interface.
Provides a memory cache for the credentials and means to query the information from the user.
- Since:
- 4246
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSynchronous credentials provider. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static AbstractCredentialsAgent.CredentialsProviderprotected Map<Pair<Authenticator.RequestorType,String>, PasswordAuthentication> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCredentials(Authenticator.RequestorType requestorType, String host, boolean noSuccessWithLastResponse) Returns the credentials needed to to access host.abstract StringProvide the text for a checkbox that offers to save the username and password that has been entered by the user.final voidpurgeCredentialsCache(Authenticator.RequestorType requestorType) Purges the internal credentials cache for the given requestor type.voidpurgeCredentialsCache(Authenticator.RequestorType requestorType, String host) Purges the internal credentials cache for the given requestor type and host.static voidSets the global credentials provider.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.io.auth.CredentialsAgent
getPreferencesDecorationPanel, lookup, lookupOAuthAccessToken, store, storeOAuthAccessToken
-
Field Details
-
credentialsProvider
-
memoryCredentialsCache
-
-
Constructor Details
-
AbstractCredentialsAgent
public AbstractCredentialsAgent()
-
-
Method Details
-
setCredentialsProvider
Sets the global credentials provider.- Parameters:
provider- credentials provider. Called if no credentials are cached. Can be used for user login prompt
-
getCredentials
public CredentialsAgentResponse getCredentials(Authenticator.RequestorType requestorType, String host, boolean noSuccessWithLastResponse) throws CredentialsAgentException Description copied from interface:CredentialsAgentReturns the credentials needed to to access host.- Specified by:
getCredentialsin interfaceCredentialsAgent- Parameters:
requestorType- the type of service.Authenticator.RequestorType.SERVERfor the OSM API server,Authenticator.RequestorType.PROXYfor a proxy serverhost- the hostname for these credentialsnoSuccessWithLastResponse- true, if the last request with the supplied credentials failed; false otherwise. If true, implementations of this interface are advised to prompt the user for new credentials.- Returns:
- the credentials
- Throws:
CredentialsAgentException- if a problem occurs in a implementation of this interface
-
purgeCredentialsCache
Description copied from interface:CredentialsAgentPurges the internal credentials cache for the given requestor type.- Specified by:
purgeCredentialsCachein interfaceCredentialsAgent- Parameters:
requestorType- the type of service.Authenticator.RequestorType.PROXYfor a proxy server,Authenticator.RequestorType.SERVERfor other servers.
-
purgeCredentialsCache
Description copied from interface:CredentialsAgentPurges the internal credentials cache for the given requestor type and host.- Specified by:
purgeCredentialsCachein interfaceCredentialsAgent- Parameters:
requestorType- the type of service.host- the host.Authenticator.RequestorType.PROXYfor a proxy server,Authenticator.RequestorType.SERVERfor other servers.
-
getSaveUsernameAndPasswordCheckboxText
Provide the text for a checkbox that offers to save the username and password that has been entered by the user.- Returns:
- checkbox text
-