Class OAuthParameters
- java.lang.Object
-
- org.openstreetmap.josm.data.oauth.OAuthParameters
-
public final class OAuthParameters extends java.lang.Object
This class manages an immutable set of OAuth parameters.- Since:
- 2747 (static factory class since 18991)
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
OSM_API_DEFAULT
private static java.lang.String
OSM_API_DEV
private static java.lang.String
OSM_API_MASTER
private static java.util.Map<java.lang.String,jakarta.json.JsonObject>
RFC8414_RESPONSES
-
Constructor Summary
Constructors Modifier Constructor Description private
OAuthParameters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IOAuthParameters
createDefault()
Replies a set of default parameters for a consumer accessing the standard OSM server atIUrls.getDefaultOsmApiUrl()
.static IOAuthParameters
createDefault(java.lang.String apiUrl, OAuthVersion oAuthVersion)
Replies a set of default parameters for a consumer accessing an OSM server at the given API url.static IOAuthParameters
createFromApiUrl(java.lang.String apiUrl, OAuthVersion oAuthVersion)
Replies a set of parameters as defined in the preferences.private static OAuth20Parameters
getDefaultOAuth20Parameters(java.lang.String apiUrl)
Get the default OAuth 2.0 parametersprivate static jakarta.json.JsonObject
getRFC8414Parameters(java.lang.String apiUrl)
private static OAuth20Parameters
parseAuthorizationServerMetadataResponse(java.lang.String clientId, java.lang.String clientSecret, java.lang.String apiUrl, java.lang.String redirectUri, jakarta.json.JsonObject serverMetadata)
Parse the response from RFC 8414 (OAuth 2.0 Authorization Server Metadata)
-
-
-
Field Detail
-
RFC8414_RESPONSES
private static final java.util.Map<java.lang.String,jakarta.json.JsonObject> RFC8414_RESPONSES
-
OSM_API_DEFAULT
private static final java.lang.String OSM_API_DEFAULT
- See Also:
- Constant Field Values
-
OSM_API_DEV
private static final java.lang.String OSM_API_DEV
- See Also:
- Constant Field Values
-
OSM_API_MASTER
private static final java.lang.String OSM_API_MASTER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OAuthParameters
private OAuthParameters()
-
-
Method Detail
-
createDefault
public static IOAuthParameters createDefault()
Replies a set of default parameters for a consumer accessing the standard OSM server atIUrls.getDefaultOsmApiUrl()
.Note that this may make network requests for RFC 8414 compliant endpoints.
- Returns:
- a set of default parameters
-
createDefault
public static IOAuthParameters createDefault(java.lang.String apiUrl, OAuthVersion oAuthVersion)
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
.Note that this may make network requests for RFC 8414 compliant endpoints.
- Parameters:
apiUrl
- The API URL for which the OAuth default parameters are created. If null or empty, the default OSM API url is used.oAuthVersion
- The OAuth version to create default parameters for- Returns:
- a set of default parameters for the given
apiUrl
- Since:
- 18650
-
getRFC8414Parameters
private static jakarta.json.JsonObject getRFC8414Parameters(java.lang.String apiUrl)
-
getDefaultOAuth20Parameters
private static OAuth20Parameters getDefaultOAuth20Parameters(java.lang.String apiUrl)
Get the default OAuth 2.0 parameters- Parameters:
apiUrl
- The API url- Returns:
- The default parameters
-
parseAuthorizationServerMetadataResponse
private static OAuth20Parameters parseAuthorizationServerMetadataResponse(java.lang.String clientId, java.lang.String clientSecret, java.lang.String apiUrl, java.lang.String redirectUri, jakarta.json.JsonObject serverMetadata) throws OAuthException
Parse the response from RFC 8414 (OAuth 2.0 Authorization Server Metadata)- Returns:
- The parameters for the server metadata
- Throws:
OAuthException
-
createFromApiUrl
public static IOAuthParameters createFromApiUrl(java.lang.String apiUrl, OAuthVersion oAuthVersion)
Replies a set of parameters as defined in the preferences.- Parameters:
oAuthVersion
- The OAuth version to use.apiUrl
- the API URL. Must not benull
.- Returns:
- the parameters
- Since:
- 18650
-
-