Package com.nimbusds.oauth2.sdk.auth
Class ClientAuthentication
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.auth.ClientAuthentication
-
- Direct Known Subclasses:
JWTAuthentication
,PlainClientSecret
,TLSClientAuthentication
public abstract class ClientAuthentication extends Object
Base abstract class for client authentication at the Token endpoint.Related specifications:
- OAuth 2.0 (RFC 6749), section 2.3.
- JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants (RFC 7523), section 2.2.
- OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens (draft-ietf-oauth-mtls-15), section 2.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClientAuthentication(ClientAuthenticationMethod method, ClientID clientID)
Creates a new abstract client authentication.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract 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()
Returns the client identifier.abstract Set<String>
getFormParameterNames()
Returns the name of the form parameters, if such are used by the authentication method.ClientAuthenticationMethod
getMethod()
Returns the client authentication method.static ClientAuthentication
parse(HTTPRequest httpRequest)
Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod
).
-
-
-
Constructor Detail
-
ClientAuthentication
protected ClientAuthentication(ClientAuthenticationMethod method, ClientID clientID)
Creates a new abstract client authentication.- Parameters:
method
- The client authentication method. Must not benull
.clientID
- The client identifier. Must not benull
.
-
-
Method Detail
-
getMethod
public ClientAuthenticationMethod getMethod()
Returns the client authentication method.- Returns:
- The client authentication method.
-
getClientID
public ClientID getClientID()
Returns the client identifier.- Returns:
- The client identifier.
-
getFormParameterNames
public abstract Set<String> getFormParameterNames()
Returns the name of the form parameters, if such are used by the authentication method.- Returns:
- The form parameter names, empty set if none.
-
parse
public static ClientAuthentication parse(HTTPRequest httpRequest) throws ParseException
Parses the specified HTTP request for a supported client authentication (seeClientAuthenticationMethod
). This method is intended to aid parsing of authenticatedTokenRequest
s.- Parameters:
httpRequest
- The HTTP request to parse. Must not benull
.- Returns:
- The client authentication method,
null
if none or the method is not supported. - Throws:
ParseException
- If the inferred client authentication couldn't be parsed.
-
applyTo
public abstract 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).- Parameters:
httpRequest
- The HTTP request. Must not benull
.
-
-