Class TokenFactory

java.lang.Object
com.codingchili.core.security.TokenFactory

public class TokenFactory extends Object
Verifies and generates tokens for access.
  • Constructor Details

    • TokenFactory

      public TokenFactory(CoreContext core, byte[] secret)
      Parameters:
      core - the core context to run async operations on.
      secret - the secret to use to generate HMAC tokens, must not be null.
  • Method Details

    • verify

      public io.vertx.core.Future<Void> verify(Token token)
      Verifies the validity of the given token.
      Parameters:
      token - the token to be verified.
      Returns:
      true if the token is accepted.
    • hmac

      public io.vertx.core.Future<Void> hmac(Token token)
      Signs the given token using HMAC.
      Parameters:
      token - the token to sign, sets the key of this token.
      Returns:
      callback.
    • sign

      public io.vertx.core.Future<Void> sign(Token token, String keystore)
      Signs the given token using the private key in the named JKS. If the JKS does not exist an error will be thrown.
      Parameters:
      token - the token to be signed.
      keystore - the keystore that contains the private key to use for signing.
      Returns:
      callback