Package org.yamcs.http.auth
Class JwtHelper
java.lang.Object
org.yamcs.http.auth.JwtHelper
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.gson.JsonObject
static com.google.gson.JsonObject
decodeUnverified
(String token) static String
generateHS256Token
(com.google.gson.JsonObject claims, byte[] secret) Generates a signed JSON Web Token appended with a signature which can be used to validate the JWT by whoever knows the specified secret.static String
generateHS256Token
(String issuer, String subject, byte[] secret, int ttl) Generates a signed JSON Web Token appended with a signature which can be used to validate the JWT by whoever knows the specified secret.static String
generateUnsignedToken
(com.google.gson.JsonObject claims) Generates an unsigned JSON Web Token using fully custom claims.static String
generateUnsignedToken
(String issuer, String subject, int ttl) Generates an unsigned JSON Web Token using default claims iss, sub, iat and exp
-
Constructor Details
-
JwtHelper
public JwtHelper()
-
-
Method Details
-
generateUnsignedToken
Generates an unsigned JSON Web Token using default claims iss, sub, iat and exp -
generateUnsignedToken
Generates an unsigned JSON Web Token using fully custom claims. -
generateHS256Token
public static String generateHS256Token(String issuer, String subject, byte[] secret, int ttl) throws InvalidKeyException, NoSuchAlgorithmException Generates a signed JSON Web Token appended with a signature which can be used to validate the JWT by whoever knows the specified secret. -
generateHS256Token
public static String generateHS256Token(com.google.gson.JsonObject claims, byte[] secret) throws InvalidKeyException, NoSuchAlgorithmException Generates a signed JSON Web Token appended with a signature which can be used to validate the JWT by whoever knows the specified secret. -
decodeUnverified
public static com.google.gson.JsonObject decodeUnverified(String token) throws JwtHelper.JwtDecodeException - Throws:
JwtHelper.JwtDecodeException
-
decode
public static com.google.gson.JsonObject decode(String token, byte[] secret) throws JwtHelper.JwtDecodeException, InvalidKeyException, NoSuchAlgorithmException
-