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 java.lang.Object implements CredentialsAgent
Partial implementation of theCredentialsAgentinterface.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 interfaceAbstractCredentialsAgent.CredentialsProviderSynchronous credentials provider.
-
Field Summary
Fields Modifier and Type Field Description private static AbstractCredentialsAgent.CredentialsProvidercredentialsProviderprotected java.util.Map<Pair<java.net.Authenticator.RequestorType,java.lang.String>,java.net.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 CredentialsAgentResponsegetCredentials(java.net.Authenticator.RequestorType requestorType, java.lang.String host, boolean noSuccessWithLastResponse)Returns the credentials needed to to access host.abstract java.lang.StringgetSaveUsernameAndPasswordCheckboxText()Provide the text for a checkbox that offers to save the username and password that has been entered by the user.voidpurgeCredentialsCache(java.net.Authenticator.RequestorType requestorType)Purges the internal credentials cache for the given requestor type.voidpurgeCredentialsCache(java.net.Authenticator.RequestorType requestorType, java.lang.String host)Purges the internal credentials cache for the given requestor type and host.static voidsetCredentialsProvider(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 java.util.Map<Pair<java.net.Authenticator.RequestorType,java.lang.String>,java.net.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(java.net.Authenticator.RequestorType requestorType, java.lang.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
public final void purgeCredentialsCache(java.net.Authenticator.RequestorType requestorType)
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
public void purgeCredentialsCache(java.net.Authenticator.RequestorType requestorType, java.lang.String host)
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
public abstract java.lang.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
-
-