Package org.openstreetmap.josm.io.auth
Class JosmPreferencesCredentialAgent
- java.lang.Object
-
- org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
-
- org.openstreetmap.josm.io.auth.JosmPreferencesCredentialAgent
-
- All Implemented Interfaces:
CredentialsAgent
public class JosmPreferencesCredentialAgent extends AbstractCredentialsAgent
This is the default credentials agent in JOSM. It keeps username and password for both the OSM API and an optional HTTP proxy in the JOSM preferences file.- Since:
- 2641
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
AbstractCredentialsAgent.CredentialsProvider
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
memoryCredentialsCache
-
-
Constructor Summary
Constructors Constructor Description JosmPreferencesCredentialAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Component
getPreferencesDecorationPanel()
Provide a Panel that is shown below the API password / username fields in the JOSM Preferences.String
getSaveUsernameAndPasswordCheckboxText()
Provide the text for a checkbox that offers to save the username and password that has been entered by the user.PasswordAuthentication
lookup(Authenticator.RequestorType requestorType, 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(Authenticator.RequestorType requestorType, String host, PasswordAuthentication credentials)
Saves the credentials incredentials
for the given service type.void
storeOAuthAccessToken(OAuthToken accessToken)
Stores the OAuth Access TokenaccessToken
.-
Methods inherited from class org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
getCredentials, purgeCredentialsCache, setCredentialsProvider
-
-
-
-
Constructor Detail
-
JosmPreferencesCredentialAgent
public JosmPreferencesCredentialAgent()
-
-
Method Detail
-
lookup
public PasswordAuthentication lookup(Authenticator.RequestorType requestorType, String host) throws CredentialsAgentException
Description copied from interface:CredentialsAgent
Looks up the credentials for a given type.- 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 credentials- Returns:
- the credentials
- Throws:
CredentialsAgentException
- if a problem occurs in a implementation of this interface- See Also:
CredentialsAgent.lookup(java.net.Authenticator.RequestorType, java.lang.String)
-
store
public void store(Authenticator.RequestorType requestorType, String host, PasswordAuthentication credentials) throws CredentialsAgentException
Description copied from interface:CredentialsAgent
Saves the credentials incredentials
for the given service type.- 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 credentialscredentials
- the credentials- Throws:
CredentialsAgentException
- if a problem occurs in a implementation of this interface- See Also:
CredentialsAgent.store(java.net.Authenticator.RequestorType, java.lang.String, java.net.PasswordAuthentication)
-
lookupOAuthAccessToken
public 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 CredentialManager.- Returns:
- the current OAuth Access Token to access the OSM server.
- Throws:
CredentialsAgentException
- if something goes wrong
-
storeOAuthAccessToken
public void storeOAuthAccessToken(OAuthToken accessToken) throws CredentialsAgentException
Stores the OAuth Access TokenaccessToken
.- Parameters:
accessToken
- the access Token. null, to remove the Access Token.- Throws:
CredentialsAgentException
- if something goes wrong
-
getPreferencesDecorationPanel
public Component getPreferencesDecorationPanel()
Description copied from interface:CredentialsAgent
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
-
getSaveUsernameAndPasswordCheckboxText
public String getSaveUsernameAndPasswordCheckboxText()
Description copied from class:AbstractCredentialsAgent
Provide the text for a checkbox that offers to save the username and password that has been entered by the user.- Specified by:
getSaveUsernameAndPasswordCheckboxText
in classAbstractCredentialsAgent
- Returns:
- checkbox text
-
-