public final class JwtUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JwtUtil.Address
Address class representing the JSON object for address.
|
| Modifier and Type | Method and Description |
|---|---|
static java.math.BigInteger |
asBigInteger(JsonObject json,
java.lang.String key,
java.lang.String description)
Extract a key value from json object that is base64-url encoded and convert it to big integer.
|
static byte[] |
asByteArray(JsonObject json,
java.lang.String key,
java.lang.String description)
Extract a key value from json object that is a base64-url encoded byte array.
|
static java.lang.String |
asString(JsonObject json,
java.lang.String key,
java.lang.String description)
Extract a key value from json object that is string.
|
static java.util.Optional<java.math.BigInteger> |
getBigInteger(JsonObject json,
java.lang.String key,
java.lang.String description)
Extract a key value from json object that is base64-url encoded and convert it to big integer if present.
|
static java.util.Optional<byte[]> |
getByteArray(JsonObject json,
java.lang.String key,
java.lang.String description)
Extract a key value from json object that is a base64-url encoded byte array, if present.
|
static java.security.KeyFactory |
getKeyFactory(java.lang.String algorithm)
Create a key factory for algorithm.
|
static javax.crypto.Mac |
getMac(java.lang.String algorithm)
Create a MAC for algorithm.
|
static java.security.Signature |
getSignature(java.lang.String signatureAlgorithm)
Create a signature for algorithm.
|
static java.util.Optional<java.lang.String> |
getString(JsonObject json,
java.lang.String key)
Extract a key value from json object that is string if present.
|
static java.util.Optional<java.util.List<java.lang.String>> |
getStrings(JsonObject json,
java.lang.String key)
Extract a key value from json object that is a list of strings if present.
|
static java.lang.Object |
toObject(JsonValue jsonValue)
Transform from json to object.
|
static java.util.Map<java.lang.String,JsonValue> |
transformToJson(java.util.Map<java.lang.String,java.lang.Object> claims)
Transform a map of strings to objects to a map of string to JSON values.
|
public static java.math.BigInteger asBigInteger(JsonObject json, java.lang.String key, java.lang.String description) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readdescription - description of the field for error handlingJwtException - in case the key is not present or is of invalid contentpublic static java.lang.String asString(JsonObject json, java.lang.String key, java.lang.String description) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readdescription - description of the field for error handlingJwtException - in case the key is not present or is of invalid contentpublic static java.util.Optional<java.math.BigInteger> getBigInteger(JsonObject json, java.lang.String key, java.lang.String description) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readdescription - description of the field for error handlingJwtException - in case the key is of invalid contentpublic static java.util.Optional<java.util.List<java.lang.String>> getStrings(JsonObject json, java.lang.String key) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readJwtException - in case the key is of invalid contentpublic static java.util.Optional<java.lang.String> getString(JsonObject json, java.lang.String key) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readJwtException - in case the key is of invalid contentpublic static java.util.Optional<byte[]> getByteArray(JsonObject json, java.lang.String key, java.lang.String description) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readdescription - description of the field for error handlingJwtException - in case the key is of invalid content or not base64 encodedpublic static byte[] asByteArray(JsonObject json, java.lang.String key, java.lang.String description) throws JwtException
json - JsonObject to read key fromkey - key of the value we want to readdescription - description of the field for error handlingJwtException - in case the key is not present, is of invalid content or not base64 encodedpublic static java.security.KeyFactory getKeyFactory(java.lang.String algorithm)
throws JwtException
algorithm - security algorithm (such as RSA, EC)JwtException - in case the algorithm is invalidpublic static java.security.Signature getSignature(java.lang.String signatureAlgorithm)
throws JwtException
signatureAlgorithm - security signature algorithm (such as "SHA512withRSA")JwtException - in case the algorithm is invalid or not supported by this JVMpublic static javax.crypto.Mac getMac(java.lang.String algorithm)
throws JwtException
algorithm - security MAC algorithmJwtException - in case the algorithm is invalid or not supported by this JVMpublic static java.util.Map<java.lang.String,JsonValue> transformToJson(java.util.Map<java.lang.String,java.lang.Object> claims)
claims - map to transform frompublic static java.lang.Object toObject(JsonValue jsonValue)
jsonValue - json valueCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.