Package com.codingchili.core.security
Class TokenFactory
java.lang.Object
com.codingchili.core.security.TokenFactory
Verifies and generates tokens for access.
-
Constructor Details
-
TokenFactory
- 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
Verifies the validity of the given token.- Parameters:
token
- the token to be verified.- Returns:
- true if the token is accepted.
-
hmac
Signs the given token using HMAC.- Parameters:
token
- the token to sign, sets the key of this token.- Returns:
- callback.
-
sign
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
-