com.google.api.client.auth.oauth2.draft10
Class AuthorizationRequestUrl
java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.http.GenericUrl
com.google.api.client.auth.oauth2.draft10.AuthorizationRequestUrl
- All Implemented Interfaces:
- Cloneable, Map<String,Object>
public class AuthorizationRequestUrl
- extends GenericUrl
OAuth 2.0 (draft 10) URL builder for an authorization web page to allow the end user to authorize
the application to access their protected resources as specified in Obtaining End-User
Authorization.
Use AuthorizationResponse to parse the redirect response after the end user grants/denies
the request.
Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
AuthorizationRequestUrl builder =
new AuthorizationRequestUrl(BASE_AUTHORIZATION_URL, CLIENT_ID);
builder.redirectUri = REDIRECT_URL;
builder.scope = SCOPE;
response.sendRedirect(builder.build());
return;
}
- Since:
- 1.4
- Author:
- Yaniv Inbar
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
|
Field Summary |
String |
clientId
(REQUIRED) The client identifier. |
String |
redirectUri
(REQUIRED, unless a redirection URI has been established between the client and authorization
server via other means) An absolute URI to which the authorization server will redirect the
user-agent to when the end-user authorization step is completed. |
String |
responseType
(REQUIRED) The requested response: an access token, an authorization code, or both. |
String |
scope
(OPTIONAL) The scope of the access request expressed as a list of space-delimited strings. |
String |
state
(OPTIONAL) An opaque value used by the client to maintain state between the request and
callback. |
| Methods inherited from class com.google.api.client.http.GenericUrl |
appendRawPath, build, clone, equals, getAll, getFirst, getRawPath, hashCode, setRawPath, toPathParts, toString |
responseType
public String responseType
- (REQUIRED) The requested response: an access token, an authorization code, or both. The
parameter value MUST be set to "token" for requesting an access token, "code" for requesting an
authorization code, or "code_and_token" to request both. The authorization server MAY decline
to provide one or more of these response types. For convenience, you may use
AuthorizationRequestUrl.ResponseType to set this value.
By default, the response type is "code", but this may be overridden.
clientId
public String clientId
- (REQUIRED) The client identifier.
redirectUri
public String redirectUri
- (REQUIRED, unless a redirection URI has been established between the client and authorization
server via other means) An absolute URI to which the authorization server will redirect the
user-agent to when the end-user authorization step is completed. The authorization server
SHOULD require the client to pre-register their redirection URI.
scope
public String scope
- (OPTIONAL) The scope of the access request expressed as a list of space-delimited strings. The
value of the "scope" parameter is defined by the authorization server. If the value contains
multiple space-delimited strings, their order does not matter, and each string adds an
additional access range to the requested scope.
state
public String state
- (OPTIONAL) An opaque value used by the client to maintain state between the request and
callback. The authorization server includes this value when redirecting the user-agent back to
the client.
AuthorizationRequestUrl
public AuthorizationRequestUrl(String encodedAuthorizationServerUrl)
- Parameters:
encodedAuthorizationServerUrl - encoded authorization server URL
AuthorizationRequestUrl
public AuthorizationRequestUrl(String encodedAuthorizationServerUrl,
String clientId)
- Parameters:
encodedAuthorizationServerUrl - encoded authorization server URLclientId - client identifier
Copyright © 2010-2011 Google. All Rights Reserved.