@Immutable public final class ClientSecretBasic extends ClientAuthentication
ClientAuthenticationMethod.CLIENT_SECRET_BASIC
.
Example HTTP Authorization header (for client identifier "s6BhdRkqt3" and secret "7Fjfp0ZBr1KtDRbnfVdmIw"):
Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
Related specifications:
Constructor and Description |
---|
ClientSecretBasic(ClientID clientID,
Secret secret)
Creates a new client secret basic authentication.
|
Modifier and Type | Method and Description |
---|---|
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).
|
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(java.lang.String header)
Parses a client secret basic authentication from the specified HTTP
Authorization header.
|
java.lang.String |
toHTTPAuthorizationHeader()
Returns the HTTP Authorization header representation of this client
secret basic authentication.
|
getClientID, getMethod
public ClientSecretBasic(ClientID clientID, Secret secret)
clientID
- The client identifier. Must not be null
.secret
- The client secret. Must not be null
.public Secret getClientSecret()
public java.lang.String toHTTPAuthorizationHeader()
Example HTTP Authorization header (for client identifier "Aladdin" and password "open sesame"):
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
See RFC 2617, section 2.
public void applyTo(HTTPRequest httpRequest)
ClientAuthentication
applyTo
in class ClientAuthentication
httpRequest
- The HTTP request. Must not be null
.public static ClientSecretBasic parse(java.lang.String header) throws ParseException
header
- The HTTP Authorization header to parse. Must not be
null
.ParseException
- If the header couldn't be parsed to a client
secret basic authentication.public static ClientSecretBasic parse(HTTPRequest httpRequest) throws ParseException
httpRequest
- The HTTP request to parse. Must not be
null
and must contain a valid
Authorization header.ParseException
- If the HTTP Authorization header couldn't be
parsed to a client secret basic
authentication.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.