com.nimbusds.oauth2.sdk.auth
Class ClientSecretBasic

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

@Immutable
public final class ClientSecretBasic
extends ClientAuthentication

Client secret basic authentication at the Token endpoint. Implements ClientAuthenticationMethod.CLIENT_SECRET_BASIC. This class is immutable.

Example HTTP Authorization header (for client identifier "s6BhdRkqt3" and secret "7Fjfp0ZBr1KtDRbnfVdmIw"):

 Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
 

Related specifications:

Version:
$version$ (2013-05-13)
Author:
Vladimir Dzhuvinov

Constructor Summary
ClientSecretBasic(ClientID clientID, Secret secret)
          Creates a new client secret basic 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 ClientSecretBasic parse(HTTPRequest httpRequest)
          Parses a client secret basic authentication from the specified HTTP request.
static ClientSecretBasic parse(String header)
          Parses a client secret basic authentication from the specified HTTP Authorization header.
 String toHTTPAuthorizationHeader()
          Returns the HTTP Authorization header representation of this client secret basic 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

ClientSecretBasic

public ClientSecretBasic(ClientID clientID,
                         Secret secret)
Creates a new client secret basic 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.

toHTTPAuthorizationHeader

public String toHTTPAuthorizationHeader()
Returns the HTTP Authorization header representation of this client secret basic authentication.

Example HTTP Authorization header (for client identifier "Aladdin" and password "open sesame"):

 Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
 

See RFC 2617, section 2.

Returns:
The HTTP Authorization header.

applyTo

public void applyTo(HTTPRequest httpRequest)
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.

parse

public static ClientSecretBasic parse(String header)
                               throws ParseException
Parses a client secret basic authentication from the specified HTTP Authorization header.

Parameters:
header - The HTTP Authorization header to parse. Must not be null.
Returns:
The client secret basic authentication.
Throws:
ParseException - If the header couldn't be parsed to a client secret basic authentication.

parse

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

Parameters:
httpRequest - The HTTP request to parse. Must not be null and must contain a valid Authorization header.
Returns:
The client secret basic authentication.
Throws:
ParseException - If the HTTP Authorization header couldn't be parsed to a client secret basic authentication.


Copyright © 2013 NimbusDS. All Rights Reserved.