Package com.nimbusds.oauth2.sdk.auth
Class ClientAuthentication
java.lang.Object
com.nimbusds.oauth2.sdk.auth.ClientAuthentication
- Direct Known Subclasses:
JWTAuthentication,PlainClientSecret,TLSClientAuthentication
Base abstract class for client authentication.
Related specifications:
- OAuth 2.0 (RFC 6749)
- JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants (RFC 7523)
- OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens (RFC 8705)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClientAuthentication(ClientAuthenticationMethod method, ClientID clientID) Creates a new abstract client authentication. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidapplyTo(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 client identifier.Returns the names of the form parameters if used by the authentication method.Returns the client authentication method.static ClientAuthenticationparse(HTTPRequest httpRequest) Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod).static List<ClientAuthentication>parseCandidates(HTTPRequest httpRequest) Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod).
-
Constructor Details
-
ClientAuthentication
Creates a new abstract client authentication.- Parameters:
method- The client authentication method. Must not benull.clientID- The client identifier. Must not benull.
-
-
Method Details
-
getMethod
Returns the client authentication method.- Returns:
- The client authentication method.
-
getClientID
Returns the client identifier.- Returns:
- The client identifier.
-
getFormParameterNames
Returns the names of the form parameters if used by the authentication method.- Returns:
- The form parameter names, empty set if none.
-
parse
Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod).- Parameters:
httpRequest- The HTTP request to parse. Must not benull.- Returns:
- The client authentication,
nullif none or the HTTP method is not supported. - Throws:
ParseException- If the client authentication couldn't be parsed.
-
parseCandidates
public static List<ClientAuthentication> parseCandidates(HTTPRequest httpRequest) throws ParseException Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod).- Parameters:
httpRequest- The HTTP request to parse. Must not benull.- Returns:
- The client authentication candidates,
nullif none or the HTTP method is not supported. - Throws:
ParseException- If the client authentication couldn't be parsed.
-
applyTo
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).- Parameters:
httpRequest- The HTTP request. Must not benull.
-