public final class JwtUtil extends 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 BigInteger |
asBigInteger(JsonObject json,
String key,
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,
String key,
String description)
Extract a key value from json object that is a base64-url encoded byte array.
|
static String |
asString(JsonObject json,
String key,
String description)
Extract a key value from json object that is string.
|
static Optional<BigInteger> |
getBigInteger(JsonObject json,
String key,
String description)
Extract a key value from json object that is base64-url encoded and convert it to big integer if present.
|
static Optional<byte[]> |
getByteArray(JsonObject json,
String key,
String description)
Extract a key value from json object that is a base64-url encoded byte array, if present.
|
static KeyFactory |
getKeyFactory(String algorithm)
Create a key factory for algorithm.
|
static Mac |
getMac(String algorithm)
Create a MAC for algorithm.
|
static Signature |
getSignature(String signatureAlgorithm)
Create a signature for algorithm.
|
static Optional<String> |
getString(JsonObject json,
String key)
Extract a key value from json object that is string if present.
|
static Optional<List<String>> |
getStrings(JsonObject json,
String key)
Extract a key value from json object that is a list of strings if present.
|
static Object |
toObject(JsonValue jsonValue)
Transform from json to object.
|
static Map<String,JsonValue> |
transformToJson(Map<String,Object> claims)
Transform a map of strings to objects to a map of string to JSON values.
|
public static BigInteger asBigInteger(JsonObject json, String key, 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 String asString(JsonObject json, String key, 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 Optional<BigInteger> getBigInteger(JsonObject json, String key, 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 Optional<List<String>> getStrings(JsonObject json, 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 Optional<String> getString(JsonObject json, 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 Optional<byte[]> getByteArray(JsonObject json, String key, 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, String key, 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 KeyFactory getKeyFactory(String algorithm) throws JwtException
algorithm - security algorithm (such as RSA, EC)JwtException - in case the algorithm is invalidpublic static Signature getSignature(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 Mac getMac(String algorithm) throws JwtException
algorithm - security MAC algorithmJwtException - in case the algorithm is invalid or not supported by this JVMpublic static Map<String,JsonValue> transformToJson(Map<String,Object> claims)
claims - map to transform fromCopyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.