Package org.openstreetmap.josm.io.auth
Interface CredentialsAgent
- All Known Implementing Classes:
AbstractCredentialsAgent,CredentialsManager,JosmPreferencesCredentialAgent
public interface CredentialsAgent
A CredentialsAgent manages two credentials:
- the credential for
Authenticator.RequestorType.SERVERwhich is equal to the OSM API credentials in JOSM - the credential for
Authenticator.RequestorType.PROXYwhich is equal to the credentials for an optional HTTP proxy server a user may use
-
Method Summary
Modifier and TypeMethodDescriptiongetCredentials(Authenticator.RequestorType requestorType, String host, boolean noSuccessWithLastResponse) Returns the credentials needed to to access host.Provide a Panel that is shown below the API password / username fields in the JOSM Preferences.lookup(Authenticator.RequestorType requestorType, String host) Looks up the credentials for a given type.lookupOAuthAccessToken(String host) Lookup the current OAuth Access Token to access the specified server.voidpurgeCredentialsCache(Authenticator.RequestorType requestorType) Purges the internal credentials cache for the given requestor type.default voidpurgeCredentialsCache(Authenticator.RequestorType requestorType, String host) Purges the internal credentials cache for the given requestor type and host.voidstore(Authenticator.RequestorType requestorType, String host, PasswordAuthentication credentials) Saves the credentials incredentialsfor the given service type.voidstoreOAuthAccessToken(String host, IOAuthToken accessToken) Stores the OAuth Access TokenaccessToken.
-
Method Details
-
lookup
PasswordAuthentication lookup(Authenticator.RequestorType requestorType, String host) throws CredentialsAgentException Looks up the credentials for a given type.- Parameters:
requestorType- the type of service.Authenticator.RequestorType.SERVERfor the OSM API server,Authenticator.RequestorType.PROXYfor a proxy serverhost- the hostname for these credentials- Returns:
- the credentials
- Throws:
CredentialsAgentException- if a problem occurs in a implementation of this interface
-
store
void store(Authenticator.RequestorType requestorType, String host, PasswordAuthentication credentials) throws CredentialsAgentException Saves the credentials incredentialsfor the given service type.- Parameters:
requestorType- the type of service.Authenticator.RequestorType.SERVERfor the OSM API server,Authenticator.RequestorType.PROXYfor a proxy serverhost- the hostname for these credentialscredentials- the credentials- Throws:
CredentialsAgentException- if a problem occurs in a implementation of this interface
-
getCredentials
CredentialsAgentResponse getCredentials(Authenticator.RequestorType requestorType, String host, boolean noSuccessWithLastResponse) throws CredentialsAgentException Returns the credentials needed to to access host.- 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
-
lookupOAuthAccessToken
Lookup the current OAuth Access Token to access the specified server. Replies null, if no Access Token is currently managed by this CredentialAgent.- Parameters:
host- The host to get OAuth credentials for- Returns:
- the current OAuth Access Token to access the specified server.
- Throws:
CredentialsAgentException- if something goes wrong- Since:
- 18650
-
storeOAuthAccessToken
Stores the OAuth Access TokenaccessToken.- Parameters:
host- The host the access token is foraccessToken- the access Token. null, to remove the Access Token. This will remove all IOAuthTokens not managed bystoreOAuthAccessToken(String, IOAuthToken).- Throws:
CredentialsAgentException- if something goes wrong- Since:
- 18650
-
purgeCredentialsCache
Purges the internal credentials cache for the given requestor type.- Parameters:
requestorType- the type of service.Authenticator.RequestorType.PROXYfor a proxy server,Authenticator.RequestorType.SERVERfor other servers.- Since:
- 12992
-
purgeCredentialsCache
Purges the internal credentials cache for the given requestor type and host.- Parameters:
requestorType- the type of service.host- the host.Authenticator.RequestorType.PROXYfor a proxy server,Authenticator.RequestorType.SERVERfor other servers.
-
getPreferencesDecorationPanel
Provide a Panel that is shown below the API password / username fields in the JOSM Preferences. (E.g. a warning that password is saved unencrypted.)- Returns:
- Panel
-