Class Answers
- java.lang.Object
-
- org.forgerock.selfservice.core.util.Answers
-
public final class Answers extends Object
Utility methods for hashing and normalising answers to KBA questions.- Since:
- 0.9.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JsonValue
hashAnswer(CryptoService cryptoService, JsonValue answer)
Hashes the given answer.static JsonValue
hashAnswer(CryptoService cryptoService, JsonValue cryptoConfig, JsonValue answer)
Hashes the given answer.static String
normaliseAnswer(String answer)
Normalises the given answer.
-
-
-
Method Detail
-
hashAnswer
public static JsonValue hashAnswer(CryptoService cryptoService, JsonValue answer) throws InternalServerErrorException
Hashes the given answer. If already hashed, it is returned unchanged. ThrowsInternalServerErrorException
if the provided answer is not a String or cannot be hashed.- Parameters:
cryptoService
- an instance of theCryptoService
to perform the hashinganswer
- the value to be hashed.- Returns:
- the hashed string value.
- Throws:
InternalServerErrorException
- if the provided answer is not a String or cannot be hashed
-
hashAnswer
public static JsonValue hashAnswer(CryptoService cryptoService, JsonValue cryptoConfig, JsonValue answer) throws InternalServerErrorException
Hashes the given answer. If already hashed, it is returned unchanged. ThrowsInternalServerErrorException
if the provided answer is not a String or cannot be hashed.- Parameters:
cryptoService
- an instance of theCryptoService
to perform the hashingcryptoConfig
- configuration for the hash algorithmanswer
- the value to be hashed.- Returns:
- the hashed string value.
- Throws:
InternalServerErrorException
- if the provided answer is not a String or cannot be hashed
-
-