|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.io.auth.CredentialsManager
public class CredentialsManager
CredentialManager is a factory for the single credential agent used.
Currently, it defaults to replying an instance of JosmPreferencesCredentialAgent
.
Nested Class Summary | |
---|---|
static interface |
CredentialsManager.CredentialsAgentFactory
|
Field Summary | |
---|---|
private static CredentialsManager.CredentialsAgentFactory |
agentFactory
|
private CredentialsAgent |
delegate
non-static fields and methods |
private static CredentialsManager |
instance
|
Constructor Summary | |
---|---|
CredentialsManager(CredentialsAgent delegate)
|
Method Summary | |
---|---|
CredentialsAgentResponse |
getCredentials(java.net.Authenticator.RequestorType requestorType,
java.lang.String host,
boolean noSuccessWithLastResponse)
|
static CredentialsManager |
getInstance()
Replies the single credential agent used in JOSM |
java.awt.Component |
getPreferencesDecorationPanel()
Provide a Panel that is shown below the API password / username fields in the JOSM Preferences. |
java.lang.String |
getUsername()
|
java.lang.String |
getUsername(java.lang.String host)
|
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. |
static void |
registerCredentialsAgentFactory(CredentialsManager.CredentialsAgentFactory agentFactory)
Plugins can register a CredentialsAgentFactory, thereby overriding JOSM's default credentials agent. |
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 . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static CredentialsManager instance
private static CredentialsManager.CredentialsAgentFactory agentFactory
private CredentialsAgent delegate
Constructor Detail |
---|
public CredentialsManager(CredentialsAgent delegate)
Method Detail |
---|
public static CredentialsManager getInstance()
public static void registerCredentialsAgentFactory(CredentialsManager.CredentialsAgentFactory agentFactory)
agentFactory
- The Factory that provides the custom CredentialsAgent.
Can be null to clear the factory and switch back to default behavior.public java.lang.String getUsername()
public java.lang.String getUsername(java.lang.String host)
public java.net.PasswordAuthentication lookup(java.net.Authenticator.RequestorType requestorType, java.lang.String host) throws CredentialsAgentException
CredentialsAgent
lookup
in interface CredentialsAgent
CredentialsAgentException
- thrown if a problem occurs in a implementation of this interfacepublic void store(java.net.Authenticator.RequestorType requestorType, java.lang.String host, java.net.PasswordAuthentication credentials) throws CredentialsAgentException
CredentialsAgent
credentials
for the given service type.
store
in interface CredentialsAgent
credentials
- the credentials
CredentialsAgentException
public CredentialsAgentResponse getCredentials(java.net.Authenticator.RequestorType requestorType, java.lang.String host, boolean noSuccessWithLastResponse) throws CredentialsAgentException
getCredentials
in interface CredentialsAgent
requestorType
- the type of service. Authenticator.RequestorType.SERVER
for the OSM API server, Authenticator.RequestorType.PROXY
for a proxy servernoSuccessWithLastResponse
- 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
- thrown if a problem occurs in a implementation of this interfacepublic OAuthToken lookupOAuthAccessToken() throws CredentialsAgentException
CredentialsAgent
lookupOAuthAccessToken
in interface CredentialsAgent
CredentialsAgentException
- thrown if something goes wrongpublic void storeOAuthAccessToken(OAuthToken accessToken) throws CredentialsAgentException
CredentialsAgent
accessToken
.
storeOAuthAccessToken
in interface CredentialsAgent
accessToken
- the access Token. null, to remove the Access Token.
CredentialsAgentException
- thrown if something goes wrongpublic java.awt.Component getPreferencesDecorationPanel()
CredentialsAgent
getPreferencesDecorationPanel
in interface CredentialsAgent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |