@Immutable public class TokenRequest extends AbstractOptionallyIdentifiedRequest
access token
and an
optional refresh token
at the Token endpoint of the authorisation server.
Example token request with an authorisation code grant:
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-URIencoded Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW grant_type=authorization_code &code=SplxlOBeZQQYbYS6WxSbIA &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb
Related specifications:
Constructor and Description |
---|
TokenRequest(URI uri,
AuthorizationGrant authzGrant)
Creates a new token request, without client authentication and a
specified client identifier.
|
TokenRequest(URI uri,
AuthorizationGrant authzGrant,
Scope scope)
Creates a new token request, without client authentication and a
specified client identifier.
|
TokenRequest(URI uri,
ClientAuthentication clientAuth,
AuthorizationGrant authzGrant)
Creates a new token request with the specified client
authentication.
|
TokenRequest(URI uri,
ClientAuthentication clientAuth,
AuthorizationGrant authzGrant,
Scope scope)
Creates a new token request with the specified client
authentication.
|
TokenRequest(URI uri,
ClientID clientID,
AuthorizationGrant authzGrant)
Creates a new token request, with no explicit client authentication
(may be present in the grant depending on its type).
|
TokenRequest(URI uri,
ClientID clientID,
AuthorizationGrant authzGrant,
Scope scope)
Creates a new token request, with no explicit client authentication
(may be present in the grant depending on its type).
|
Modifier and Type | Method and Description |
---|---|
AuthorizationGrant |
getAuthorizationGrant()
Gets the authorisation grant.
|
Scope |
getScope()
Gets the requested scope.
|
static TokenRequest |
parse(HTTPRequest httpRequest)
Parses a token request from the specified HTTP request.
|
HTTPRequest |
toHTTPRequest()
Returns the matching HTTP request.
|
getClientID
getClientAuthentication
getEndpointURI
public TokenRequest(URI uri, ClientAuthentication clientAuth, AuthorizationGrant authzGrant, Scope scope)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientAuth
- The client authentication. Must not be
null
.authzGrant
- The authorisation grant. Must not be null
.scope
- The requested scope, null
if not
specified.public TokenRequest(URI uri, ClientAuthentication clientAuth, AuthorizationGrant authzGrant)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientAuth
- The client authentication. Must not be
null
.authzGrant
- The authorisation grant. Must not be null
.public TokenRequest(URI uri, ClientID clientID, AuthorizationGrant authzGrant, Scope scope)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientID
- The client identifier, null
if not
specified.authzGrant
- The authorisation grant. Must not be null
.scope
- The requested scope, null
if not
specified.public TokenRequest(URI uri, ClientID clientID, AuthorizationGrant authzGrant)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientID
- The client identifier, null
if not
specified.authzGrant
- The authorisation grant. Must not be null
.public TokenRequest(URI uri, AuthorizationGrant authzGrant, Scope scope)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.authzGrant
- The authorisation grant. Must not be null
.scope
- The requested scope, null
if not
specified.public TokenRequest(URI uri, AuthorizationGrant authzGrant)
uri
- The URI of the token endpoint. May be
null
if the toHTTPRequest()
method
will not be used.authzGrant
- The authorisation grant. Must not be null
.public AuthorizationGrant getAuthorizationGrant()
public Scope getScope()
null
if not specified.public HTTPRequest toHTTPRequest()
Request
public static TokenRequest parse(HTTPRequest httpRequest) throws ParseException
httpRequest
- The HTTP request. Must not be null
.ParseException
- If the HTTP request couldn't be parsed to a
token request.Copyright © 2016 Connect2id Ltd.. All Rights Reserved.