org.openstreetmap.josm.io.auth
Interface CredentialsAgent

All Known Implementing Classes:
AbstractCredentialsAgent, CredentialsManager, JosmPreferencesCredentialAgent

public interface CredentialsAgent

A CredentialsAgent manages two credentials:

In addition, it manages an OAuth Access Token for accessing the OSM server.


Method Summary
 CredentialsAgentResponse getCredentials(java.net.Authenticator.RequestorType requestorType, java.lang.String host, boolean noSuccessWithLastResponse)
           
 java.awt.Component getPreferencesDecorationPanel()
          Provide a Panel that is shown below the API password / username fields in the JOSM Preferences.
 java.net.PasswordAuthentication lookup(java.net.Authenticator.RequestorType requestorType, java.lang.String host)
          Looks up the credentials for a given type.
 OAuthToken lookupOAuthAccessToken()
          Lookup the current OAuth Access Token to access the OSM server.
 void store(java.net.Authenticator.RequestorType requestorType, java.lang.String host, java.net.PasswordAuthentication credentials)
          Saves the credentials in credentials for the given service type.
 void storeOAuthAccessToken(OAuthToken accessToken)
          Stores the OAuth Access Token accessToken.
 

Method Detail

lookup

java.net.PasswordAuthentication lookup(java.net.Authenticator.RequestorType requestorType,
                                       java.lang.String host)
                                       throws CredentialsAgentException
Looks up the credentials for a given type.

Parameters:
the - type of service. Authenticator.RequestorType.SERVER for the OSM API server, Authenticator.RequestorType.PROXY for a proxy server
Returns:
the credentials
Throws:
CredentialsAgentException - thrown if a problem occurs in a implementation of this interface

store

void store(java.net.Authenticator.RequestorType requestorType,
           java.lang.String host,
           java.net.PasswordAuthentication credentials)
           throws CredentialsAgentException
Saves the credentials in credentials for the given service type.

Parameters:
the - type of service. Authenticator.RequestorType.SERVER for the OSM API server, Authenticator.RequestorType.PROXY for a proxy server
credentials - the credentials
Throws:
CredentialsManagerException - thrown if a problem occurs in a implementation of this interface
CredentialsAgentException

getCredentials

CredentialsAgentResponse getCredentials(java.net.Authenticator.RequestorType requestorType,
                                        java.lang.String host,
                                        boolean noSuccessWithLastResponse)
                                        throws CredentialsAgentException
Parameters:
requestorType - the type of service. Authenticator.RequestorType.SERVER for the OSM API server, Authenticator.RequestorType.PROXY for a proxy server
noSuccessWithLastResponse - 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.
Throws:
CredentialsAgentException - thrown if a problem occurs in a implementation of this interface

lookupOAuthAccessToken

OAuthToken lookupOAuthAccessToken()
                                  throws CredentialsAgentException
Lookup the current OAuth Access Token to access the OSM server. Replies null, if no Access Token is currently managed by this CredentialAgent.

Returns:
the current OAuth Access Token to access the OSM server.
Throws:
CredentialsAgentException - thrown if something goes wrong

storeOAuthAccessToken

void storeOAuthAccessToken(OAuthToken accessToken)
                           throws CredentialsAgentException
Stores the OAuth Access Token accessToken.

Parameters:
accessToken - the access Token. null, to remove the Access Token.
Throws:
CredentialsAgentException - thrown if something goes wrong

getPreferencesDecorationPanel

java.awt.Component 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.)



JOSM