com.nimbusds.oauth2.sdk.auth
Class ClientSecretPost

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.auth.ClientAuthentication
      extended by com.nimbusds.oauth2.sdk.auth.ClientSecretPost

@Immutable
public final class ClientSecretPost
extends ClientAuthentication

Client secret post authentication at the Token endpoint. Implements ClientAuthenticationMethod.CLIENT_SECRET_POST. This class is immutable.

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
ClientSecretPost(ClientID clientID, Secret secret)
          Creates a new client secret post authentication.
 
Method Summary
 void applyTo(HTTPRequest httpRequest)
          Applies the authentication to the specified HTTP request by setting its Authorization header and/or POST entity-body parameters (according to the implemented client authentication method).
 ClientID getClientID()
          Gets the client identifier.
 Secret getClientSecret()
          Gets the client secret.
static ClientSecretPost parse(HTTPRequest httpRequest)
          Parses a client secret post authentication from the specified HTTP POST request.
static ClientSecretPost parse(Map<String,String> params)
          Parses a client secret post authentication from the specified parameters map.
static ClientSecretPost parse(String paramsString)
          Parses a client secret post authentication from the specified application/x-www-form-urlencoded encoded parameters string.
 Map<String,String> toParameters()
          Returns the parameter representation of this client secret post authentication.
 
Methods inherited from class com.nimbusds.oauth2.sdk.auth.ClientAuthentication
getMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSecretPost

public ClientSecretPost(ClientID clientID,
                        Secret secret)
Creates a new client secret post authentication.

Parameters:
clientID - The client identifier. Must not be null.
secret - The client secret. Must not be null.
Method Detail

getClientID

public ClientID getClientID()
Gets the client identifier.

Returns:
The client identifier.

getClientSecret

public Secret getClientSecret()
Gets the client secret.

Returns:
The client secret.

toParameters

public Map<String,String> toParameters()
Returns the parameter representation of this client secret post authentication. Note that the parameters are not application/x-www-form-urlencoded encoded.

Parameters map:

 "client_id" -> [client-identifier]
 "client_secret" -> [client-secret]
 

Returns:
The parameters map, with keys "client_id" and "client_secret".

applyTo

public void applyTo(HTTPRequest httpRequest)
             throws SerializeException
Description copied from class: ClientAuthentication
Applies the authentication to the specified HTTP request by setting its Authorization header and/or POST entity-body parameters (according to the implemented client authentication method).

Specified by:
applyTo in class ClientAuthentication
Parameters:
httpRequest - The HTTP request. Must not be null.
Throws:
SerializeException - If the client authentication parameters couldn't be applied to the HTTP request.

parse

public static ClientSecretPost parse(Map<String,String> params)
                              throws ParseException
Parses a client secret post authentication from the specified parameters map. Note that the parameters must not be application/x-www-form-urlencoded encoded.

Parameters:
params - The parameters map to parse. The client secret post parameters must be keyed under "client_id" and "client_secret". The map must not be null.
Returns:
The client secret post authentication.
Throws:
ParseException - If the parameters map couldn't be parsed to a client secret post authentication.

parse

public static ClientSecretPost parse(String paramsString)
                              throws ParseException
Parses a client secret post authentication from the specified application/x-www-form-urlencoded encoded parameters string.

Parameters:
paramsString - The parameters string to parse. The client secret post parameters must be keyed under "client_id" and "client_secret". The string must not be null.
Returns:
The client secret post authentication.
Throws:
ParseException - If the parameters string couldn't be parsed to a client secret post authentication.

parse

public static ClientSecretPost parse(HTTPRequest httpRequest)
                              throws ParseException
Parses a client secret post authentication from the specified HTTP POST request.

Parameters:
httpRequest - The HTTP POST request to parse. Must not be null and must contain a valid application/x-www-form-urlencoded encoded parameters string in the entity body. The client secret post parameters must be keyed under "client_id" and "client_secret".
Returns:
The client secret post authentication.
Throws:
ParseException - If the HTTP request header couldn't be parsed to a valid client secret post authentication.


Copyright © 2013 NimbusDS. All Rights Reserved.