@Immutable public final class PrivateKeyJWT extends JWTAuthentication
ClientAuthenticationMethod.PRIVATE_KEY_JWT
.
Supported signature JSON Web Algorithms (JWAs) by this implementation:
Example TokenRequest
with private key JWT
authentication:
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=authorization_code& code=i1WsRn1uB1& client_id=s6BhdRkqt3& client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer& client_assertion=PHNhbWxwOl...[omitted for brevity]...ZT
Related specifications:
CLIENT_ASSERTION_TYPE
Constructor and Description |
---|
PrivateKeyJWT(ClientID clientID,
URI tokenEndpoint,
com.nimbusds.jose.JWSAlgorithm jwsAlgorithm,
ECPrivateKey ecPrivateKey,
String keyID,
Provider jcaProvider)
Creates a new EC private key JWT authentication.
|
PrivateKeyJWT(ClientID clientID,
URI tokenEndpoint,
com.nimbusds.jose.JWSAlgorithm jwsAlgorithm,
RSAPrivateKey rsaPrivateKey,
String keyID,
Provider jcaProvider)
Creates a new RSA private key JWT authentication.
|
PrivateKeyJWT(JWTAuthenticationClaimsSet jwtAuthClaimsSet,
com.nimbusds.jose.JWSAlgorithm jwsAlgorithm,
ECPrivateKey ecPrivateKey,
String keyID,
Provider jcaProvider)
Creates a new EC private key JWT authentication.
|
PrivateKeyJWT(JWTAuthenticationClaimsSet jwtAuthClaimsSet,
com.nimbusds.jose.JWSAlgorithm jwsAlgorithm,
RSAPrivateKey rsaPrivateKey,
String keyID,
Provider jcaProvider)
Creates a new RSA private key JWT authentication.
|
PrivateKeyJWT(com.nimbusds.jwt.SignedJWT clientAssertion)
Creates a new private key JWT authentication.
|
Modifier and Type | Method and Description |
---|---|
static PrivateKeyJWT |
parse(HTTPRequest httpRequest)
Parses the specified HTTP POST request for a private key JSON Web
Token (JWT) authentication.
|
static PrivateKeyJWT |
parse(Map<String,String> params)
Parses the specified parameters map for a private key JSON Web Token
(JWT) authentication.
|
static PrivateKeyJWT |
parse(String paramsString)
Parses a private key JSON Web Token (JWT) authentication from the
specified
application/x-www-form-urlencoded encoded
parameters string. |
static Set<com.nimbusds.jose.JWSAlgorithm> |
supportedJWAs()
Returns the supported signature JSON Web Algorithms (JWAs).
|
applyTo, ensureClientAssertionType, getClientAssertion, getJWTAuthenticationClaimsSet, parseClientAssertion, parseClientID, toParameters
getClientID, getMethod
public PrivateKeyJWT(ClientID clientID, URI tokenEndpoint, com.nimbusds.jose.JWSAlgorithm jwsAlgorithm, RSAPrivateKey rsaPrivateKey, String keyID, Provider jcaProvider) throws com.nimbusds.jose.JOSEException
clientID
- The client identifier. Must not be
null
.tokenEndpoint
- The token endpoint URI of the authorisation
server. Must not be null
.jwsAlgorithm
- The expected RSA signature algorithm (RS256,
RS384 or RS512) for the private key JWT
assertion. Must be supported and not
null
.rsaPrivateKey
- The RSA private key. Must not be null
.keyID
- Optional identifier for the RSA key, to aid
key selection at the authorisation server.
Recommended. null
if not specified.jcaProvider
- Optional specific JCA provider, null
to
use the default one.com.nimbusds.jose.JOSEException
- If RSA signing failed.public PrivateKeyJWT(JWTAuthenticationClaimsSet jwtAuthClaimsSet, com.nimbusds.jose.JWSAlgorithm jwsAlgorithm, RSAPrivateKey rsaPrivateKey, String keyID, Provider jcaProvider) throws com.nimbusds.jose.JOSEException
jwtAuthClaimsSet
- The JWT authentication claims set. Must not
be null
.jwsAlgorithm
- The expected RSA signature algorithm (RS256,
RS384 or RS512) for the private key JWT
assertion. Must be supported and not
null
.rsaPrivateKey
- The RSA private key. Must not be
null
.keyID
- Optional identifier for the RSA key, to aid
key selection at the authorisation server.
Recommended. null
if not specified.jcaProvider
- Optional specific JCA provider, null
to use the default one.com.nimbusds.jose.JOSEException
- If RSA signing failed.public PrivateKeyJWT(ClientID clientID, URI tokenEndpoint, com.nimbusds.jose.JWSAlgorithm jwsAlgorithm, ECPrivateKey ecPrivateKey, String keyID, Provider jcaProvider) throws com.nimbusds.jose.JOSEException
clientID
- The client identifier. Must not be
null
.tokenEndpoint
- The token endpoint URI of the authorisation
server. Must not be null
.jwsAlgorithm
- The expected EC signature algorithm (ES256,
ES384 or ES512) for the private key JWT
assertion. Must be supported and not
null
.ecPrivateKey
- The EC private key. Must not be null
.keyID
- Optional identifier for the EC key, to aid key
selection at the authorisation server.
Recommended. null
if not specified.jcaProvider
- Optional specific JCA provider, null
to
use the default one.com.nimbusds.jose.JOSEException
- If RSA signing failed.public PrivateKeyJWT(JWTAuthenticationClaimsSet jwtAuthClaimsSet, com.nimbusds.jose.JWSAlgorithm jwsAlgorithm, ECPrivateKey ecPrivateKey, String keyID, Provider jcaProvider) throws com.nimbusds.jose.JOSEException
jwtAuthClaimsSet
- The JWT authentication claims set. Must not
be null
.jwsAlgorithm
- The expected ES signature algorithm (ES256,
ES384 or ES512) for the private key JWT
assertion. Must be supported and not
null
.ecPrivateKey
- The EC private key. Must not be
null
.keyID
- Optional identifier for the EC key, to aid
key selection at the authorisation server.
Recommended. null
if not specified.jcaProvider
- Optional specific JCA provider, null
to use the default one.com.nimbusds.jose.JOSEException
- If RSA signing failed.public PrivateKeyJWT(com.nimbusds.jwt.SignedJWT clientAssertion)
clientAssertion
- The client assertion, corresponding to the
client_assertion
parameter, as a
supported RSA or ECDSA-signed JWT. Must be
signed and not null
.public static Set<com.nimbusds.jose.JWSAlgorithm> supportedJWAs()
public static PrivateKeyJWT parse(Map<String,String> params) throws ParseException
application/x-www-form-urlencoded
encoded.params
- The parameters map to parse. The private key JSON
Web Token (JWT) parameters must be keyed under
"client_assertion" and "client_assertion_type". The
map must not be null
.ParseException
- If the parameters map couldn't be parsed to a
private key JSON Web Token (JWT)
authentication.public static PrivateKeyJWT parse(String paramsString) throws ParseException
application/x-www-form-urlencoded
encoded
parameters string.paramsString
- The parameters string to parse. The private key
JSON Web Token (JWT) parameters must be keyed
under "client_assertion" and
"client_assertion_type". The string must not be
null
.ParseException
- If the parameters string couldn't be parsed
to a private key JSON Web Token (JWT)
authentication.public static PrivateKeyJWT parse(HTTPRequest httpRequest) throws ParseException
httpRequest
- The HTTP POST request to parse. Must not be
null
and must contain a valid
application/x-www-form-urlencoded
encoded
parameters string in the entity body. The private
key JSON Web Token (JWT) parameters must be
keyed under "client_assertion" and
"client_assertion_type".ParseException
- If the HTTP request header couldn't be parsed
to a private key JSON Web Token (JWT)
authentication.Copyright © 2016 Connect2id Ltd.. All Rights Reserved.