Class OAuthParameters
- java.lang.Object
-
- org.openstreetmap.josm.data.oauth.OAuthParameters
-
public class OAuthParameters extends Object
This class manages an immutable set of OAuth parameters.- Since:
- 2747
-
-
Field Summary
Fields Modifier and Type Field Description private String
accessTokenUrl
private String
authoriseUrl
private String
consumerKey
private String
consumerSecret
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).private String
osmLoginUrl
private String
osmLogoutUrl
private String
requestTokenUrl
-
Constructor Summary
Constructors Constructor Description OAuthParameters(String consumerKey, String consumerSecret, String requestTokenUrl, String accessTokenUrl, String authoriseUrl, String osmLoginUrl, String osmLogoutUrl)
Constructs a newOAuthParameters
.OAuthParameters(OAuthParameters other)
Creates a clone of the parameters inother
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description oauth.signpost.OAuthConsumer
buildConsumer()
Builds anOAuthConsumer
based on these parameters.oauth.signpost.OAuthProvider
buildProvider(oauth.signpost.OAuthConsumer consumer)
Builds anOAuthProvider
based on these parameters and a OAuth consumerconsumer
.static OAuthParameters
createDefault()
Replies a set of default parameters for a consumer accessing the standard OSM server atIUrls.getDefaultOsmApiUrl()
.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
createFromApiUrl(String apiUrl)
Replies a set of parameters as defined in the preferences.boolean
equals(Object o)
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
getOsmLoginUrl()
Gets the URL used to login users on the website (for automatic mode).String
getOsmLogoutUrl()
Gets the URL used to logout users on the website (for automatic mode).String
getRequestTokenUrl()
Gets the request token URL.int
hashCode()
void
rememberPreferences()
Remembers the current values in the preferences.
-
-
-
Field Detail
-
DEFAULT_JOSM_CONSUMER_KEY
public static final String DEFAULT_JOSM_CONSUMER_KEY
The default JOSM OAuth consumer key (created by user josmeditor).- See Also:
- Constant Field Values
-
DEFAULT_JOSM_CONSUMER_SECRET
public static final String DEFAULT_JOSM_CONSUMER_SECRET
The default JOSM OAuth consumer secret (created by user josmeditor).- See Also:
- Constant Field Values
-
consumerKey
private final String consumerKey
-
consumerSecret
private final String consumerSecret
-
requestTokenUrl
private final String requestTokenUrl
-
accessTokenUrl
private final String accessTokenUrl
-
authoriseUrl
private final String authoriseUrl
-
osmLoginUrl
private final String osmLoginUrl
-
osmLogoutUrl
private final String osmLogoutUrl
-
-
Constructor Detail
-
OAuthParameters
public OAuthParameters(String consumerKey, String consumerSecret, String requestTokenUrl, String accessTokenUrl, String authoriseUrl, String osmLoginUrl, String osmLogoutUrl)
Constructs a newOAuthParameters
.- Parameters:
consumerKey
- consumer keyconsumerSecret
- consumer secretrequestTokenUrl
- request token URLaccessTokenUrl
- access token URLauthoriseUrl
- authorise URLosmLoginUrl
- the OSM login URL (for automatic mode)osmLogoutUrl
- the OSM logout URL (for automatic mode)- Since:
- 9220
- See Also:
createDefault()
,createFromApiUrl(java.lang.String)
-
OAuthParameters
public OAuthParameters(OAuthParameters other)
Creates a clone of the parameters inother
.- Parameters:
other
- the other parameters. Must not be null.- Throws:
IllegalArgumentException
- if other is null
-
-
Method Detail
-
createDefault
public static OAuthParameters createDefault()
Replies a set of default parameters for a consumer accessing the standard OSM server atIUrls.getDefaultOsmApiUrl()
.- Returns:
- a set of default parameters
-
createDefault
public static OAuthParameters createDefault(String apiUrl)
Replies a set of default parameters for a consumer accessing an OSM server at the given API url. URL parameters are only set if the URL equalsIUrls.getDefaultOsmApiUrl()
or references the domain "dev.openstreetmap.org", otherwise they may benull
.- Parameters:
apiUrl
- The API URL for which the OAuth default parameters are created. If null or empty, the default OSM API url is used.- Returns:
- a set of default parameters for the given
apiUrl
- Since:
- 5422
-
createFromApiUrl
public static OAuthParameters createFromApiUrl(String apiUrl)
Replies a set of parameters as defined in the preferences.- Parameters:
apiUrl
- the API URL. Must not be null.- Returns:
- the parameters
-
rememberPreferences
public void rememberPreferences()
Remembers the current values in the preferences.
-
getConsumerKey
public String getConsumerKey()
Gets the consumer key.- Returns:
- The consumer key
-
getConsumerSecret
public String getConsumerSecret()
Gets the consumer secret.- Returns:
- The consumer secret
-
getRequestTokenUrl
public String getRequestTokenUrl()
Gets the request token URL.- Returns:
- The request token URL
-
getAccessTokenUrl
public String getAccessTokenUrl()
Gets the access token URL.- Returns:
- The access token URL
-
getAuthoriseUrl
public String getAuthoriseUrl()
Gets the authorise URL.- Returns:
- The authorise URL
-
getOsmLoginUrl
public String getOsmLoginUrl()
Gets the URL used to login users on the website (for automatic mode).- Returns:
- The URL used to login users
-
getOsmLogoutUrl
public String getOsmLogoutUrl()
Gets the URL used to logout users on the website (for automatic mode).- Returns:
- The URL used to logout users
-
buildConsumer
public oauth.signpost.OAuthConsumer buildConsumer()
Builds anOAuthConsumer
based on these parameters.- Returns:
- the consumer
-
buildProvider
public oauth.signpost.OAuthProvider buildProvider(oauth.signpost.OAuthConsumer consumer)
Builds anOAuthProvider
based on these parameters and a OAuth consumerconsumer
.- Parameters:
consumer
- the consumer. Must not be null.- Returns:
- the provider
- Throws:
IllegalArgumentException
- if consumer is null
-
-