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
public abstract class AbstractCredentialsAgent extends Object implements CredentialsAgent
Partial implementation of theCredentialsAgent
interface.Provides a memory cache for the credentials and means to query the information from the user.
- Since:
- 4246
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractCredentialsAgent.CredentialsProvider
Synchronous credentials provider.
-
Field Summary
Fields Modifier and Type Field Description private static AbstractCredentialsAgent.CredentialsProvider
credentialsProvider
protected Map<Authenticator.RequestorType,PasswordAuthentication>
memoryCredentialsCache
-
Constructor Summary
Constructors Constructor Description AbstractCredentialsAgent()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CredentialsAgentResponse
getCredentials(Authenticator.RequestorType requestorType, String host, boolean noSuccessWithLastResponse)
Returns the credentials needed to to access host.abstract String
getSaveUsernameAndPasswordCheckboxText()
Provide the text for a checkbox that offers to save the username and password that has been entered by the user.void
purgeCredentialsCache(Authenticator.RequestorType requestorType)
Purges the internal credentials cache for the given requestor type.static void
setCredentialsProvider(AbstractCredentialsAgent.CredentialsProvider provider)
Sets the global credentials provider.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.io.auth.CredentialsAgent
getPreferencesDecorationPanel, lookup, lookupOAuthAccessToken, store, storeOAuthAccessToken
-
-
-
-
Field Detail
-
credentialsProvider
private static volatile AbstractCredentialsAgent.CredentialsProvider credentialsProvider
-
memoryCredentialsCache
protected Map<Authenticator.RequestorType,PasswordAuthentication> memoryCredentialsCache
-
-
Constructor Detail
-
AbstractCredentialsAgent
public AbstractCredentialsAgent()
-
-
Method Detail
-
setCredentialsProvider
public static void setCredentialsProvider(AbstractCredentialsAgent.CredentialsProvider provider)
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:CredentialsAgent
Returns the credentials needed to to access host.- Specified by:
getCredentials
in interfaceCredentialsAgent
- Parameters:
requestorType
- the type of service.Authenticator.RequestorType.SERVER
for the OSM API server,Authenticator.RequestorType.PROXY
for 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
public final void purgeCredentialsCache(Authenticator.RequestorType requestorType)
Description copied from interface:CredentialsAgent
Purges the internal credentials cache for the given requestor type.- Specified by:
purgeCredentialsCache
in interfaceCredentialsAgent
- Parameters:
requestorType
- the type of service.Authenticator.RequestorType.SERVER
for the OSM API server,Authenticator.RequestorType.PROXY
for a proxy server
-
getSaveUsernameAndPasswordCheckboxText
public abstract String 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
-
-