public class AuthorizationRequest extends Object implements android.os.Parcelable
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<AuthorizationRequest> |
CREATOR
CREATER required by
Parcelable interface. |
| Constructor and Description |
|---|
AuthorizationRequest()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AuthorizationRequest |
addParameter(String name,
String value)
Add an extra parameter to the authorization request.
|
AuthorizationRequest |
addScopes(String... scopes)
Add scopes, which are elements in the value of
scope parameter (OPTIONAL parameter). |
int |
describeContents() |
String |
getClientId()
Get the client ID (= the value of
client_id parameter
(REQUIRED parameter)). |
URL |
getEndpoint()
Get the authorization endpoint.
|
Map<String,String> |
getExtraParameters()
Get extra parameters added to the authorization request.
|
URL |
getRedirectUri()
Get the redirect URI (= the value of
redirect_uri parameter
(OPTIONAL parameter)). |
ResponseType |
getResponseType()
Get the response type (= the value of
response_type
parameter (REQUIRED parameter)). |
char |
getScopeDelimiter()
Get the delimiter for scopes.
|
Set<String> |
getScopeSet()
Get the scopes, which are elements in the value of
scope parameter (OPTIONAL parameter). |
String |
getState()
Get the state (= the value of
state parameter
(RECOMMENDED parameter)). |
AuthorizationRequest |
removeParameter(String name)
Remove an extra parameter from the authorization request.
|
AuthorizationRequest |
removeScopes(String... scopes)
Remove scopes, which are elements in the value of
scope parameter (OPTIONAL parameter). |
AuthorizationRequest |
setClientId(String clientId)
Set the client ID (= the value of
client_id parameter
(REQUIRED parameter)). |
AuthorizationRequest |
setEndpoint(String endpoint)
Set the authorization endpoint.
|
AuthorizationRequest |
setEndpoint(URL endpoint)
Set the authorization endpoint.
|
AuthorizationRequest |
setExtraParameters(Map<String,String> parameters)
Set extra parameters added to the authorization request.
|
AuthorizationRequest |
setRedirectUri(String redirectUri)
Set the redirect URI (= the value of
redirect_uri parameter
(OPTIONAL parameter)). |
AuthorizationRequest |
setRedirectUri(URL redirectUri)
Set the redirect URI (= the value of
redirect_uri parameter
(OPTIONAL parameter)). |
AuthorizationRequest |
setResponseType(ResponseType responseType)
Set the response type (= the value of
response_type
parameter (REQUIRED parameter)). |
AuthorizationRequest |
setScopeDelimiter(char delimiter)
Set the delimiter for scopes.
|
AuthorizationRequest |
setScopeSet(Set<String> scopeSet)
Set the scopes, which are elements in the value of
scope parameter (OPTIONAL parameter). |
AuthorizationRequest |
setState(String state)
Set the state (= the value of
state parameter
(RECOMMENDED parameter)). |
URL |
toURL()
Convert this authorization request to a URL.
|
void |
writeToParcel(android.os.Parcel out,
int flags) |
public static final android.os.Parcelable.Creator<AuthorizationRequest> CREATOR
Parcelable interface.public URL getEndpoint()
public AuthorizationRequest setEndpoint(URL endpoint)
endpoint - The authorization endpoint.this object.IllegalArgumentException - The endpoint includes a fragment component.
It is prohibited by the specification.public AuthorizationRequest setEndpoint(String endpoint)
endpoint - The authorization endpoint.this object.IllegalArgumentException - The given endpoint is not a valid URL, or
it includes a fragment component.public ResponseType getResponseType()
response_type
parameter (REQUIRED parameter)).public AuthorizationRequest setResponseType(ResponseType responseType)
response_type
parameter (REQUIRED parameter)).responseType - The response type.this object.public String getClientId()
client_id parameter
(REQUIRED parameter)).public AuthorizationRequest setClientId(String clientId)
client_id parameter
(REQUIRED parameter)).clientId - The client ID.this object.public URL getRedirectUri()
redirect_uri parameter
(OPTIONAL parameter)).public AuthorizationRequest setRedirectUri(URL redirectUri)
redirect_uri parameter
(OPTIONAL parameter)).
RFC 6749 (OAuth 2.0), 3.1.2. Redirection Endpoint says
"The redirection endpoint URI MUST be an absolute URI", so
this method accepts the parameter value as URL.
redirectUri - The redirect URI.this object.IllegalArgumentException - The redirect URI failed to be converted into a URL,
or it includes a fragment component.public AuthorizationRequest setRedirectUri(String redirectUri)
redirect_uri parameter
(OPTIONAL parameter)).
RFC 6749 (OAuth 2.0), 3.1.2. Redirection Endpoint says "The redirection endpoint URI MUST be an absolute URI".
redirectUri - The redirect URI.this object.IllegalArgumentException - The redirect URI includes a fragment component.
It is prohibited by the specification.public Set<String> getScopeSet()
scope parameter (OPTIONAL parameter).public AuthorizationRequest setScopeSet(Set<String> scopeSet)
scope parameter (OPTIONAL parameter).
Scopes must comply with the specification shown below.
Otherwise, IllegalArgumentException is thrown.
scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
null and an empty value do not raise
IllegalArgumentException and are just ignored.
scopeSet - Scopes to be set.this object.IllegalArgumentException - There is a scope which does not comply with the
specification.public AuthorizationRequest addScopes(String... scopes)
scope parameter (OPTIONAL parameter).
Scopes must comply with the specification shown below.
Otherwise, IllegalArgumentException is thrown.
scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
null and an empty value do not raise
IllegalArgumentException and are just ignored.
scopes - Scopes to be added.this object.IllegalArgumentException - There is a scope which does not comply with the
specification.public AuthorizationRequest removeScopes(String... scopes)
scope parameter (OPTIONAL parameter).scopes - Scopes to be removed.this object.public String getState()
state parameter
(RECOMMENDED parameter)).state parameter.public AuthorizationRequest setState(String state)
state parameter
(RECOMMENDED parameter)).state - The value of state parameter.this object.public Map<String,String> getExtraParameters()
public AuthorizationRequest setExtraParameters(Map<String,String> parameters)
parameters - Extra parameters.this object.public AuthorizationRequest addParameter(String name, String value)
"display", "touch") for Facebook.name - Parameter name.value - Parameter value.this object.public AuthorizationRequest removeParameter(String name)
name - Parameter name.this object.public char getScopeDelimiter()
public AuthorizationRequest setScopeDelimiter(char delimiter)
RFC 6749 (OAuth 2.0), 3.3. Access Token Scope says
"The value of the scope parameter is expressed as a list of
space-delimited, case-sensitive strings."
However, Facebook does not comply with this specification
and uses a comma (0x2C) as the delimiter. Therefore, for
Facebook, setScopeDelimiter(',') needs to be called.
delimiter - The scopethis object.public URL toURL()
IllegalStateException - public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel out,
int flags)
writeToParcel in interface android.os.ParcelableCopyright © 2016. All rights reserved.