Class JwtUtil


  • public class JwtUtil
    extends java.lang.Object
    Version:
    December 8, 2018
    Author:
    Javier Rojas Blum, Yuriy Movchan
    • Method Detail

      • printAlgorithmsAndProviders

        public static void printAlgorithmsAndProviders()
      • printAlgorithms

        public static void printAlgorithms​(java.lang.String algorithmType)
      • bytesToHex

        public static java.lang.String bytesToHex​(byte[] bytes)
      • getMessageDigestSHA256

        public static byte[] getMessageDigestSHA256​(java.lang.String data)
                                             throws java.security.NoSuchProviderException,
                                                    java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
      • getMessageDigestSHA384

        public static byte[] getMessageDigestSHA384​(java.lang.String data)
                                             throws java.security.NoSuchProviderException,
                                                    java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
      • getMessageDigestSHA512

        public static byte[] getMessageDigestSHA512​(java.lang.String data)
                                             throws java.security.NoSuchProviderException,
                                                    java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
      • getMessageDigest

        public static byte[] getMessageDigest​(java.lang.String data,
                                              java.lang.String algorithm)
                                       throws java.security.NoSuchProviderException,
                                              java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
      • getPublicKey

        public static PublicKey getPublicKey​(java.lang.String jwksUri,
                                             java.lang.String jwks,
                                             SignatureAlgorithm signatureAlgorithm,
                                             java.lang.String keyId)
      • getJsonKey

        public static org.json.JSONObject getJsonKey​(java.lang.String jwksUri,
                                                     java.lang.String jwks,
                                                     java.lang.String keyId)
      • getJSONWebKeys

        public static org.json.JSONObject getJSONWebKeys​(java.lang.String jwksUri)
      • getJSONWebKeys

        public static org.json.JSONObject getJSONWebKeys​(java.lang.String jwksUri,
                                                         org.jboss.resteasy.client.ClientExecutor executor)
      • fromJson

        public static org.json.JSONObject fromJson​(java.lang.String json)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • transferIntoJwtClaims

        public static void transferIntoJwtClaims​(org.json.JSONObject jsonObject,
                                                 Jwt jwt)