Package com.nimbusds.oauth2.sdk.auth
Class ClientSecretBasic
java.lang.Object
com.nimbusds.oauth2.sdk.auth.ClientAuthentication
com.nimbusds.oauth2.sdk.auth.PlainClientSecret
com.nimbusds.oauth2.sdk.auth.ClientSecretBasic
Client secret basic authentication at the Token endpoint. Implements
ClientAuthenticationMethod.CLIENT_SECRET_BASIC
.
Example HTTP Authorization header (for client identifier "s6BhdRkqt3" and secret "7Fjfp0ZBr1KtDRbnfVdmIw"):
Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
Related specifications:
- OAuth 2.0 (RFC 6749), sections 2.3.1 and 3.2.1.
- OpenID Connect Core 1.0, section 9.
- HTTP Authentication: Basic and Digest Access Authentication (RFC 2617).
-
Constructor Summary
ConstructorsConstructorDescriptionClientSecretBasic
(ClientID clientID, Secret secret) Creates a new client secret basic authentication. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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).Returns the name of the form parameters, if such are used by the authentication method.static ClientSecretBasic
parse
(HTTPRequest httpRequest) Parses a client secret basic authentication from the specified HTTP request.static ClientSecretBasic
Parses a client secret basic authentication from the specified HTTP Authorization header.Returns the HTTP Authorization header representation of this client secret basic authentication.Methods inherited from class com.nimbusds.oauth2.sdk.auth.PlainClientSecret
getClientSecret
Methods inherited from class com.nimbusds.oauth2.sdk.auth.ClientAuthentication
getClientID, getMethod
-
Constructor Details
-
ClientSecretBasic
Creates a new client secret basic authentication.- Parameters:
clientID
- The client identifier. Must not benull
.secret
- The client secret. Must not benull
.
-
-
Method Details
-
getFormParameterNames
Description copied from class:ClientAuthentication
Returns the name of the form parameters, if such are used by the authentication method.- Specified by:
getFormParameterNames
in classClientAuthentication
- Returns:
- The form parameter names, empty set if none.
-
toHTTPAuthorizationHeader
Returns the HTTP Authorization header representation of this client secret basic authentication.Note that OAuth 2.0 (RFC 6749, section 2.3.1) requires the client ID and secret to be
application/x-www-form-urlencoded
before passing them to the HTTP basic authentication algorithm. This behaviour differs from the original HTTP Basic Authentication specification (RFC 2617).Example HTTP Authorization header (for client identifier "Aladdin" and password "open sesame"):
Authorization: Basic QWxhZGRpbjpvcGVuK3Nlc2FtZQ==
See RFC 2617, section 2.
- Returns:
- The HTTP Authorization header.
-
applyTo
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 classClientAuthentication
- Parameters:
httpRequest
- The HTTP request. Must not benull
.
-
parse
Parses a client secret basic authentication from the specified HTTP Authorization header.- Parameters:
header
- The HTTP Authorization header to parse. Must not benull
.- Returns:
- The client secret basic authentication.
- Throws:
ParseException
- If the header couldn't be parsed to a client secret basic authentication.
-
parse
Parses a client secret basic authentication from the specified HTTP request.- Parameters:
httpRequest
- The HTTP request to parse. Must not benull
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.
-