@Immutable public class TokenRequest extends AbstractRequest
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.
|
ClientAuthentication |
getClientAuthentication()
Gets the client authentication.
|
ClientID |
getClientID()
Gets the client identifier (for a token request without explicit
client authentication).
|
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.
|
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 ClientAuthentication getClientAuthentication()
null
if none.getClientID()
public ClientID getClientID()
null
if not specified.getClientAuthentication()
public AuthorizationGrant getAuthorizationGrant()
public Scope getScope()
null
if not specified.public HTTPRequest toHTTPRequest() throws SerializeException
Request
SerializeException
- If the request message couldn't be
serialised to an HTTP 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 © 2015 Connect2id Ltd.. All Rights Reserved.