Class TrustedDeviceTokens
java.lang.Object
com.irurueta.authserver.authorization.application.mfa.TrustedDeviceTokens
Creates the random tokens that identify a trusted device and hashes them, so only the SHA-256 hash is ever stored.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringName of the hash algorithm.private final SecureRandomSource of randomness.static final intSize of a token in bytes (256 bits). -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TOKEN_BYTES
public static final int TOKEN_BYTESSize of a token in bytes (256 bits).- See Also:
-
HASH_ALGORITHM
Name of the hash algorithm.- See Also:
-
random
Source of randomness.
-
-
Constructor Details
-
TrustedDeviceTokens
public TrustedDeviceTokens()
-
-
Method Details
-
newToken
Creates a new random token.- Returns:
- the URL-safe token, to be handed to the browser once.
-
hash
Hashes a token.- Parameters:
token- the raw token.- Returns:
- the lowercase hexadecimal SHA-256 hash.
-