public class OAuthParameters extends Object
Modifier and Type | Field and Description |
---|---|
private String |
accessTokenUrl |
private String |
authoriseUrl |
private String |
consumerKey |
private String |
consumerSecret |
static String |
DEFAULT_ACCESS_TOKEN_URL
The default OSM OAuth access token URL.
|
static String |
DEFAULT_AUTHORISE_URL
The default OSM OAuth authorize URL.
|
static String |
DEFAULT_JOSM_CONSUMER_KEY
The default JOSM OAuth consumer key (created by user josmeditor).
|
static String |
DEFAULT_JOSM_CONSUMER_SECRET
The default JOSM OAuth consumer secret (created by user josmeditor).
|
static String |
DEFAULT_REQUEST_TOKEN_URL
The default OSM OAuth request token URL.
|
private String |
requestTokenUrl |
Constructor and Description |
---|
OAuthParameters()
Constructs a new, unitialized,
OAuthParameters . |
OAuthParameters(OAuthParameters other)
Creates a clone of the parameters in
other . |
Modifier and Type | Method and Description |
---|---|
OAuthConsumer |
buildConsumer()
Builds an
OAuthConsumer based on these parameters. |
OAuthProvider |
buildProvider(OAuthConsumer consumer)
Builds an
OAuthProvider based on these parameters and a OAuth consumer consumer . |
static OAuthParameters |
createDefault()
Replies a set of default parameters for a consumer accessing the standard OSM server
at
OsmApi.DEFAULT_API_URL . |
static OAuthParameters |
createDefault(String apiUrl)
Replies a set of default parameters for a consumer accessing an OSM server
at the given API url.
|
static OAuthParameters |
createFromPreferences(Preferences pref)
Replies a set of parameters as defined in the preferences.
|
boolean |
equals(Object obj) |
String |
getAccessTokenUrl()
Gets the access token URL.
|
String |
getAuthoriseUrl()
Gets the authorise URL.
|
String |
getConsumerKey()
Gets the consumer key.
|
String |
getConsumerSecret()
Gets the consumer secret.
|
String |
getRequestTokenUrl()
Gets the request token URL.
|
int |
hashCode() |
void |
setAccessTokenUrl(String accessTokenUrl)
Sets the access token URL.
|
void |
setAuthoriseUrl(String authoriseUrl)
Sets the authorise URL.
|
void |
setConsumerKey(String consumerKey)
Sets the consumer key.
|
void |
setConsumerSecret(String consumerSecret)
Sets the consumer secret.
|
void |
setRequestTokenUrl(String requestTokenUrl)
Sets the request token URL.
|
public static final String DEFAULT_JOSM_CONSUMER_KEY
public static final String DEFAULT_JOSM_CONSUMER_SECRET
public static final String DEFAULT_REQUEST_TOKEN_URL
public static final String DEFAULT_ACCESS_TOKEN_URL
public static final String DEFAULT_AUTHORISE_URL
private String consumerKey
private String consumerSecret
private String requestTokenUrl
private String accessTokenUrl
private String authoriseUrl
public OAuthParameters()
OAuthParameters
.public OAuthParameters(OAuthParameters other) throws IllegalArgumentException
other
.other
- the other parameters. Must not be null.IllegalArgumentException
- thrown if other is nullpublic static OAuthParameters createDefault()
OsmApi.DEFAULT_API_URL
.public static OAuthParameters createDefault(String apiUrl)
OsmApi.DEFAULT_API_URL
or references the domain "dev.openstreetmap.org", otherwise they may be null
.apiUrl
- The API URL for which the OAuth default parameters are created. If null or empty, the default OSM API url is used.apiUrl
public static OAuthParameters createFromPreferences(Preferences pref)
pref
- the preferencespublic String getConsumerKey()
public void setConsumerKey(String consumerKey)
consumerKey
- The consumer keypublic String getConsumerSecret()
public void setConsumerSecret(String consumerSecret)
consumerSecret
- The consumer secretpublic String getRequestTokenUrl()
public void setRequestTokenUrl(String requestTokenUrl)
requestTokenUrl
- the request token URLpublic String getAccessTokenUrl()
public void setAccessTokenUrl(String accessTokenUrl)
accessTokenUrl
- The access token URLpublic String getAuthoriseUrl()
public void setAuthoriseUrl(String authoriseUrl)
authoriseUrl
- The authorise URLpublic OAuthConsumer buildConsumer()
OAuthConsumer
based on these parameters.public OAuthProvider buildProvider(OAuthConsumer consumer) throws IllegalArgumentException
OAuthProvider
based on these parameters and a OAuth consumer consumer
.consumer
- the consumer. Must not be null.IllegalArgumentException
- if consumer is null