T
- the generic typeB
- the generic typepublic abstract class AbstractJWSBuilder<T extends JWS,B extends AbstractJWSBuilder<T,B>> extends JWTBuilder<T,B>
Modifier | Constructor and Description |
---|---|
protected |
AbstractJWSBuilder(Class<T> tokenType)
Instantiates a new abstract JWS builder.
|
Modifier and Type | Method and Description |
---|---|
protected T |
build(javax.json.JsonObject headersObject,
javax.json.JsonObject claimsObject)
Builds the
JsonObject of headers and claims set. |
T |
build(String json)
Builds a
JWS instance from the given json string representing an encoded
JWS. |
T |
build(String json,
byte[] key)
Builds a
JWS and validates its signatures based on the given encoded public key . |
B |
hmac256(byte[] key)
Sets HMAC using SHA-256 as signature algorithm.
|
B |
hmac384(byte[] key)
Sets HMAC using SHA-384 as signature algorithm.
|
B |
hmac512(byte[] key)
Sets HMAC using SHA-512 as signature algorithm.
|
B |
keys(JWK... keys)
Adds key(s) into the JWKSet.
|
B |
keys(JWKSet keySet)
Sets JWKSet key(s) as a JSON Web Key Set for JWS Header.
|
B |
kid(String kid)
The kid (key ID) member can be used to match a specific key.
|
B |
rsa256(byte[] key)
Sets RSASSA-PKCS-v1_5 using SHA-256 as signature algorithm.
|
B |
rsa384(byte[] key)
Sets RSASSA-PKCS-v1_5 using SHA-384 as signature algorithm.
|
B |
rsa512(byte[] key)
Sets RSASSA-PKCS-v1_5 using SHA-512 as signature algorithm.
|
audience, build, claim, claim, contentType, expiration, getClaimsBuilder, getHeadersBuilder, getTokenType, header, header, header, header, id, issuedAt, issuer, notBefore, subject, type
public B kid(String kid)
When used with JWS or JWE, the kid value is used to match a JWS or JWE kid Header Parameter value.
kid
- the kidpublic B hmac256(byte[] key)
key
- the keypublic B hmac384(byte[] key)
key
- the keypublic B hmac512(byte[] key)
key
- the keypublic B rsa256(byte[] key)
key
- the keypublic B rsa384(byte[] key)
key
- the keypublic B rsa512(byte[] key)
key
- the keypublic B keys(JWKSet keySet)
keySet
- the key setpublic B keys(JWK... keys)
keys
- the keysprotected T build(javax.json.JsonObject headersObject, javax.json.JsonObject claimsObject)
JWTBuilder
Builds the JsonObject
of headers and claims set.
build
in class JWTBuilder<T extends JWS,B extends AbstractJWSBuilder<T,B>>
headersObject
- the headers objectclaimsObject
- the claims objectJWTBuilder.build(javax.json.JsonObject, javax.json.JsonObject)
public T build(String json) throws JsonException
Builds a JWS
instance from the given json
string representing an encoded
JWS.
This method first tries to check if the given JWS provides any JWK representing the public key that should be used to validate the signature.
If no JWK is found, this method does not validate the signature but returns a JWS instance.
build
in class JWTBuilder<T extends JWS,B extends AbstractJWSBuilder<T,B>>
json
- The encoded JSON string representing a JWS.JsonException
- the json exceptionpublic T build(String json, byte[] key) throws JsonException
Builds a JWS
and validates its signatures based on the given encoded public key
.
json
- The encoded JSON string representing a JWS.key
- The encoded representation of a public key.JsonException
- the json exceptionCopyright © 2015. All rights reserved.