public abstract class AbstractCredentialsAgent extends java.lang.Object implements CredentialsAgent
CredentialsAgent
interface.
Provides a memory cache for the credentials and means to query the information from the user.
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractCredentialsAgent.CredentialsProvider
Synchronous credentials provider.
|
Modifier and Type | Field and Description |
---|---|
private static AbstractCredentialsAgent.CredentialsProvider |
credentialsProvider |
protected java.util.Map<java.net.Authenticator.RequestorType,java.net.PasswordAuthentication> |
memoryCredentialsCache |
Constructor and Description |
---|
AbstractCredentialsAgent() |
Modifier and Type | Method and Description |
---|---|
CredentialsAgentResponse |
getCredentials(java.net.Authenticator.RequestorType requestorType,
java.lang.String host,
boolean noSuccessWithLastResponse)
Returns the credentials needed to to access host.
|
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.
|
void |
purgeCredentialsCache(java.net.Authenticator.RequestorType requestorType)
Purges the internal credentials cache for the given requestor type.
|
static void |
setCredentialsProvider(AbstractCredentialsAgent.CredentialsProvider provider)
Sets the global credentials provider.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPreferencesDecorationPanel, lookup, lookupOAuthAccessToken, store, storeOAuthAccessToken
private static volatile AbstractCredentialsAgent.CredentialsProvider credentialsProvider
protected java.util.Map<java.net.Authenticator.RequestorType,java.net.PasswordAuthentication> memoryCredentialsCache
public AbstractCredentialsAgent()
public static void setCredentialsProvider(AbstractCredentialsAgent.CredentialsProvider provider)
provider
- credentials provider. Called if no credentials are cached. Can be used for user login promptpublic CredentialsAgentResponse getCredentials(java.net.Authenticator.RequestorType requestorType, java.lang.String host, boolean noSuccessWithLastResponse) throws CredentialsAgentException
CredentialsAgent
getCredentials
in interface CredentialsAgent
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.CredentialsAgentException
- if a problem occurs in a implementation of this interfacepublic final void purgeCredentialsCache(java.net.Authenticator.RequestorType requestorType)
CredentialsAgent
purgeCredentialsCache
in interface CredentialsAgent
requestorType
- the type of service.
Authenticator.RequestorType.SERVER
for the OSM API server, Authenticator.RequestorType.PROXY
for a proxy serverpublic abstract java.lang.String getSaveUsernameAndPasswordCheckboxText()