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 java.awt.Component
getPreferencesDecorationPanel()
Provide a Panel that is shown below the API password / username fields in the JOSM Preferences.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.java.net.PasswordAuthentication
lookup(java.net.Authenticator.RequestorType requestorType, java.lang.String host)
Looks up the credentials for a given type.IOAuthToken
lookupOAuthAccessToken(java.lang.String host)
Lookup the current OAuth Access Token to access the specified server.void
store(java.net.Authenticator.RequestorType requestorType, java.lang.String host, java.net.PasswordAuthentication credentials)
Saves the credentials incredentials
for the given service type.void
storeOAuthAccessToken(java.lang.String host, IOAuthToken accessToken)
Stores the OAuth Access TokenaccessToken
.-
Methods inherited from class org.openstreetmap.josm.io.auth.AbstractCredentialsAgent
getCredentials, purgeCredentialsCache, setCredentialsProvider
-
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
lookupOAuthAccessToken, storeOAuthAccessToken
-
-
-
-
Constructor Detail
-
JosmPreferencesCredentialAgent
public JosmPreferencesCredentialAgent()
-
-
Method Detail
-
lookup
public java.net.PasswordAuthentication lookup(java.net.Authenticator.RequestorType requestorType, java.lang.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(java.net.Authenticator.RequestorType requestorType, java.lang.String host, java.net.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 IOAuthToken lookupOAuthAccessToken(java.lang.String host) throws CredentialsAgentException
Description copied from interface:CredentialsAgent
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
-
storeOAuthAccessToken
public void storeOAuthAccessToken(java.lang.String host, IOAuthToken accessToken) throws CredentialsAgentException
Description copied from interface:CredentialsAgent
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 byCredentialsAgent.storeOAuthAccessToken(IOAuthToken)
.- Throws:
CredentialsAgentException
- if something goes wrong
-
getPreferencesDecorationPanel
public java.awt.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 java.lang.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
-
-