public class AuthorizationServiceConfiguration extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
AuthorizationServiceConfiguration.RetrieveConfigurationCallback
Callback interface for configuration retrieval.
|
Modifier and Type | Field and Description |
---|---|
Uri |
authorizationEndpoint
The authorization service's endpoint.
|
AuthorizationServiceDiscovery |
discoveryDoc
The discovery document describing the service, if it is an OpenID Connect provider.
|
static String |
OPENID_CONFIGURATION_WELL_KNOWN_PATH
The standard path at which an OpenID Connect discovery document can be found under an
issuer's base URI.
|
Uri |
tokenEndpoint
The authorization service's token exchange and refresh endpoint.
|
Constructor and Description |
---|
AuthorizationServiceConfiguration(AuthorizationServiceDiscovery discoveryDoc)
Creates an service configuration for an OpenID Connect provider, based on its
discovery document . |
AuthorizationServiceConfiguration(Uri authorizationEndpoint,
Uri tokenEndpoint)
Creates a service configuration for a basic OAuth2 provider.
|
Modifier and Type | Method and Description |
---|---|
static void |
fetchFromIssuer(Uri openIdConnectIssuerUri,
AuthorizationServiceConfiguration.RetrieveConfigurationCallback callback)
Fetch an AuthorizationServiceConfiguration from an OpenID Connect issuer URI.
|
static void |
fetchFromUrl(Uri openIdConnectDiscoveryUri,
AuthorizationServiceConfiguration.RetrieveConfigurationCallback callback)
Fetch a AuthorizationServiceConfiguration from an OpenID Connect discovery URI.
|
static AuthorizationServiceConfiguration |
fromJson(JSONObject json)
Reads an Authorization service configuration from a JSON representation produced by the
toJson() method or some other equivalent producer. |
static AuthorizationServiceConfiguration |
fromJson(String jsonStr)
Reads an Authorization service configuration from a JSON representation produced by the
toJson() method or some other equivalent producer. |
JSONObject |
toJson()
Converts the authorization service configuration to JSON for storage or transmission.
|
String |
toJsonString()
Converts the authorization service configuration to a JSON string for storage or
transmission.
|
public static final String OPENID_CONFIGURATION_WELL_KNOWN_PATH
@NonNull public final Uri authorizationEndpoint
@NonNull public final Uri tokenEndpoint
@Nullable public final AuthorizationServiceDiscovery discoveryDoc
public AuthorizationServiceConfiguration(@NonNull Uri authorizationEndpoint, @NonNull Uri tokenEndpoint)
authorizationEndpoint
- The
authorization endpoint URI for the service.tokenEndpoint
- The token
endpoint URI for the service.public AuthorizationServiceConfiguration(@NonNull AuthorizationServiceDiscovery discoveryDoc)
discovery document
.discoveryDoc
- The OpenID Connect discovery document which describes this service.@NonNull public JSONObject toJson()
public String toJsonString()
@NonNull public static AuthorizationServiceConfiguration fromJson(@NonNull JSONObject json) throws JSONException
toJson()
method or some other equivalent producer.JSONException
- if the provided JSON does not match the expected structure.public static AuthorizationServiceConfiguration fromJson(@NonNull String jsonStr) throws JSONException
toJson()
method or some other equivalent producer.JSONException
- if the provided JSON does not match the expected structure.public static void fetchFromIssuer(@NonNull Uri openIdConnectIssuerUri, @NonNull AuthorizationServiceConfiguration.RetrieveConfigurationCallback callback)
fetchFromUrl(Uri, RetrieveConfigurationCallback)
,
but automatically appends the OpenID connect well-known configuration path to the
URI.openIdConnectIssuerUri
- The issuer URI, e.g. "https://accounts.google.com"callback
- The callback to invoke upon completion.public static void fetchFromUrl(@NonNull Uri openIdConnectDiscoveryUri, @NonNull AuthorizationServiceConfiguration.RetrieveConfigurationCallback callback)
openIdConnectDiscoveryUri
- The OpenID Connect discovery URIcallback
- A callback to invoke upon completion