|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.oauth2.sdk.auth.ClientAuthentication com.nimbusds.oauth2.sdk.auth.JWTAuthentication
public abstract class JWTAuthentication
Base abstract class for JSON Web Token (JWT) based client authentication at the Token endpoint.
Related specifications:
Field Summary | |
---|---|
static String |
CLIENT_ASSERTION_TYPE
The expected client assertion type, corresponding to the client_assertion_type parameter. |
Constructor Summary | |
---|---|
protected |
JWTAuthentication(ClientAuthenticationMethod method,
com.nimbusds.jwt.SignedJWT clientAssertion,
ClientID clientID)
Creates a new JSON Web Token (JWT) based client 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). |
protected static void |
ensureClientAssertionType(Map<String,String> params)
Ensures the specified parameters map contains an entry with key "client_assertion_type" pointing to a string that equals the expected CLIENT_ASSERTION_TYPE . |
com.nimbusds.jwt.SignedJWT |
getClientAssertion()
Gets the client assertion, corresponding to the client_assertion parameter. |
ClientID |
getClientID()
Gets the optional client identifier, corresponding to the client_id parameter. |
JWTAuthenticationClaimsSet |
getJWTAuthenticationClaimsSet()
Gets the client authentication claims set contained in the client assertion JSON Web Token (JWT). |
static JWTAuthentication |
parse(HTTPRequest httpRequest)
Parses the specified HTTP request for a JSON Web Token (JWT) based client authentication. |
protected static com.nimbusds.jwt.SignedJWT |
parseClientAssertion(Map<String,String> params)
Parses the specified parameters map for a client assertion. |
protected static ClientID |
parseClientID(Map<String,String> params)
Parses the specified parameters map for an optional client identifier. |
Map<String,String> |
toParameters()
Returns the parameter representation of this JSON Web Token (JWT) based client 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 |
Field Detail |
---|
public static final String CLIENT_ASSERTION_TYPE
client_assertion_type
parameter. This is a URN string set to
"urn:ietf:params:oauth:client-assertion-type:jwt-bearer".
Constructor Detail |
---|
protected JWTAuthentication(ClientAuthenticationMethod method, com.nimbusds.jwt.SignedJWT clientAssertion, ClientID clientID)
method
- The client authentication method. Must not be
null
.clientAssertion
- The client assertion, corresponding to the
client_assertion
parameter, in the
form of a signed JSON Web Token (JWT). Must
not be null
.clientID
- Optional client identifier, corresponding to
the client_id
parameter. null
if not specified.Method Detail |
---|
public com.nimbusds.jwt.SignedJWT getClientAssertion()
client_assertion
parameter.
public ClientID getClientID()
client_id
parameter.
null
if not specified.public JWTAuthenticationClaimsSet getJWTAuthenticationClaimsSet() throws ParseException
ParseException
- If the client assertion JSON Web Token (JWT)
doesn't contain a client authentication
claims set.public Map<String,String> toParameters() throws SerializeException
application/x-www-form-urlencoded
encoded.
Parameters map:
"client_assertion" -> [serialised-JWT] "client_assertion_type" -> "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" "client_id" -> [optional-client-id]
SerializeException
- If the signed JWT couldn't be serialised
to a client assertion string.public void applyTo(HTTPRequest httpRequest) throws SerializeException
ClientAuthentication
applyTo
in class ClientAuthentication
httpRequest
- The HTTP request. Must not be null
.
SerializeException
- If the client authentication parameters
couldn't be applied to the HTTP request.protected static void ensureClientAssertionType(Map<String,String> params) throws ParseException
CLIENT_ASSERTION_TYPE
. This method is intended to aid
parsing of JSON Web Token (JWT) based client authentication objects.
params
- The parameters map to check. The parameters must not be
null
and
application/x-www-form-urlencoded
encoded.
ParseException
- If expected "client_assertion_type" entry
wasn't found.protected static com.nimbusds.jwt.SignedJWT parseClientAssertion(Map<String,String> params) throws ParseException
params
- The parameters map to parse. It must contain an entry
with key "client_assertion" pointing to a string that
represents a signed serialised JSON Web Token (JWT).
The parameters must not be null
and
application/x-www-form-urlencoded
encoded.
ParseException
- If a "client_assertion" entry couldn't be
retrieved from the parameters map.protected static ClientID parseClientID(Map<String,String> params)
params
- The parameters map to parse. It may contain an entry
with key "client_id" pointing to a string that
represents the client identifier. The parameters must
not be null
and
application/x-www-form-urlencoded
encoded.
null
if not specified.public static JWTAuthentication parse(HTTPRequest httpRequest) throws ParseException
httpRequest
- The HTTP request to parse. Must not be null
.
ParseException
- If a JSON Web Token (JWT) based client
authentication couldn't be retrieved from the
HTTP request.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |