Class JwtManager

java.lang.Object
org.ctan.site.services.account.JwtManager

public class JwtManager extends Object
The class JwtManager contains static utility methods for dealing with JWTs.
  • Field Details

    • VERIFIER_AUTH

      protected static final com.auth0.jwt.interfaces.JWTVerifier VERIFIER_AUTH
      The field VERIFIER contains the verifier. It is visible outside for testing purpose.
    • VERIFIER_REFRESH

      protected static final com.auth0.jwt.interfaces.JWTVerifier VERIFIER_REFRESH
      The field VERIFIER contains the verifier. It is visible outside for testing purpose.
  • Method Details

    • createAuth

      public static String createAuth(@NonNull @NonNull String account)
      Create a JWT with standard options set for authentication.
      Parameters:
      account - the user id;
      Returns:
      a new JWT
    • createRefresh

      public static String createRefresh(@NonNull @NonNull String account)
      Create a JWT with standard options set for refresh.
      Parameters:
      account - the user id;
      Returns:
      a new JWT
    • verifyAuth

      public static String verifyAuth(String token)
      The method verifyAuth provides means to verify a JWT and return the account.
      Parameters:
      token - the JWT
      Returns:
      the verified user id or null
    • verifyRefresh

      public static String verifyRefresh(String token)
      The method verify provides means to verify a JWT and return the account.
      Parameters:
      token - the JWT
      Returns:
      the verified user id or null