@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,
ClientAuthentication clientAuth,
AuthorizationGrant authzGrant)
Creates a new token request.
|
Modifier and Type | Method and Description |
---|---|
AuthorizationGrant |
getAuthorizationGrant()
Gets the authorisation grant.
|
ClientAuthentication |
getClientAuthentication()
Gets the client authentication.
|
static TokenRequest |
parse(HTTPRequest httpRequest)
Parses the specified HTTP request for a token request.
|
HTTPRequest |
toHTTPRequest()
Returns the matching HTTP request.
|
getEndpointURI
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, null
if none.authzGrant
- The authorisation grant. Must not be null
.public ClientAuthentication getClientAuthentication()
null
if none.public AuthorizationGrant getAuthorizationGrant()
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 © 2014 NimbusDS. All Rights Reserved.