Class BrowserClientRequestUrl
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.http.GenericUrl
-
- com.google.api.client.auth.oauth2.AuthorizationRequestUrl
-
- com.google.api.client.auth.oauth2.BrowserClientRequestUrl
-
- All Implemented Interfaces:
java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public class BrowserClientRequestUrl extends AuthorizationRequestUrl
OAuth 2.0 URL builder for an authorization web page to allow the end user to authorize the application to access their protected resources and that returns the access token to a browser client using a scripting language such as JavaScript, as specified in Implicit Grant.The default for
AuthorizationRequestUrl.getResponseTypes()is"token".Sample usage for a web application:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String url = new BrowserClientRequestUrl( "https://server.example.com/authorize", "s6BhdRkqt3").setState("xyz") .setRedirectUri("https://client.example.com/cb").build(); response.sendRedirect(url); }Implementation is not thread-safe.
- Since:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.Flags
-
-
Constructor Summary
Constructors Constructor Description BrowserClientRequestUrl(java.lang.String encodedAuthorizationServerUrl, java.lang.String clientId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BrowserClientRequestUrlclone()BrowserClientRequestUrlset(java.lang.String fieldName, java.lang.Object value)BrowserClientRequestUrlsetClientId(java.lang.String clientId)Sets the client identifier.BrowserClientRequestUrlsetRedirectUri(java.lang.String redirectUri)Sets the URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant (as specified in Redirection Endpoint) ornullfor none.BrowserClientRequestUrlsetResponseTypes(java.util.Collection<java.lang.String> responseTypes)Sets the response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or a list of registered extension values to join with a space.BrowserClientRequestUrlsetScopes(java.util.Collection<java.lang.String> scopes)Sets the list of scopes (as specified in Access Token Scope) ornullfor none.BrowserClientRequestUrlsetState(java.lang.String state)Sets the state (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.-
Methods inherited from class com.google.api.client.auth.oauth2.AuthorizationRequestUrl
getClientId, getRedirectUri, getResponseTypes, getScopes, getState
-
Methods inherited from class com.google.api.client.http.GenericUrl
appendRawPath, build, buildAuthority, buildRelativeUrl, equals, getAll, getFirst, getFragment, getHost, getPathParts, getPort, getRawPath, getScheme, getUserInfo, hashCode, setFragment, setHost, setPathParts, setPort, setRawPath, setScheme, setUserInfo, toPathParts, toString, toURI, toURL, toURL
-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
-
-
-
Method Detail
-
setResponseTypes
public BrowserClientRequestUrl setResponseTypes(java.util.Collection<java.lang.String> responseTypes)
Description copied from class:AuthorizationRequestUrlSets the response type, which must be"code"for requesting an authorization code,"token"for requesting an access token (implicit grant), or a list of registered extension values to join with a space.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setResponseTypesin classAuthorizationRequestUrl
-
setRedirectUri
public BrowserClientRequestUrl setRedirectUri(java.lang.String redirectUri)
Description copied from class:AuthorizationRequestUrlSets the URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant (as specified in Redirection Endpoint) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setRedirectUriin classAuthorizationRequestUrl
-
setScopes
public BrowserClientRequestUrl setScopes(java.util.Collection<java.lang.String> scopes)
Description copied from class:AuthorizationRequestUrlSets the list of scopes (as specified in Access Token Scope) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setScopesin classAuthorizationRequestUrl- Parameters:
scopes- collection of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes) ornullfor none
-
setClientId
public BrowserClientRequestUrl setClientId(java.lang.String clientId)
Description copied from class:AuthorizationRequestUrlSets the client identifier.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setClientIdin classAuthorizationRequestUrl
-
setState
public BrowserClientRequestUrl setState(java.lang.String state)
Description copied from class:AuthorizationRequestUrlSets the state (an opaque value used by the client to maintain state between the request and callback, as mentioned in Registration Requirements) ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setStatein classAuthorizationRequestUrl
-
set
public BrowserClientRequestUrl set(java.lang.String fieldName, java.lang.Object value)
- Overrides:
setin classAuthorizationRequestUrl
-
clone
public BrowserClientRequestUrl clone()
- Overrides:
clonein classAuthorizationRequestUrl
-
-