com.nimbusds.oauth2.sdk
Class TokenRequest

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.TokenRequest
All Implemented Interfaces:
Message, Request
Direct Known Subclasses:
AccessTokenRequest, RefreshTokenRequest

public abstract class TokenRequest
extends Object
implements Request

The base abstract class for access token and refresh token requests to the Token endpoint. The request type can be inferred by calling getGrantType().

Example access token request:

 POST /token HTTP/1.1
 Host: server.example.com
 Content-Type: application/x-www-form-urlencoded
 Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
 
 grant_type=authorization_code
 &code=SplxlOBeZQQYbYS6WxSbIA
 &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb
 

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
protected TokenRequest(GrantType grantType, ClientAuthentication clientAuth)
          Creates a new token request.
 
Method Summary
 ClientAuthentication getClientAuthentication()
          Gets the client authentication.
 GrantType getGrantType()
          Gets the grant type.
static TokenRequest parse(HTTPRequest httpRequest)
          Parses the specified HTTP request for a token request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.oauth2.sdk.Request
toHTTPRequest
 

Constructor Detail

TokenRequest

protected TokenRequest(GrantType grantType,
                       ClientAuthentication clientAuth)
Creates a new token request.

Parameters:
grantType - The grant type. Must not be null.
clientAuth - The client authentication, null if none.
Method Detail

getGrantType

public GrantType getGrantType()
Gets the grant type.

Returns:
The grant type.

getClientAuthentication

public ClientAuthentication getClientAuthentication()
Gets the client authentication.

Returns:
The client authentication, null if none.

parse

public static TokenRequest parse(HTTPRequest httpRequest)
                          throws ParseException
Parses the specified HTTP request for a token request.

Parameters:
httpRequest - The HTTP request. Must not be null.
Returns:
The token request.
Throws:
ParseException - If the HTTP request couldn't be parsed to a token request.


Copyright © 2013 NimbusDS. All Rights Reserved.