Make configuration enums in lowercase. Wrap create hashes by try-catch. Add initial part of the documentation.

This commit is contained in:
Anatoly Sablin
2019-11-15 23:39:45 +03:00
parent 9e4cabb69b
commit f9daf4d58a
8 changed files with 83 additions and 20 deletions

View File

@@ -23,27 +23,28 @@ public class HashingConfig {
LOGGER.info(" Pepper length: {}", getPepperLength());
LOGGER.info(" Rotation policy: {}", getRotationPolicy());
LOGGER.info(" Hash storage type: {}", getHashStorageType());
if (RotationPolicyEnum.PER_SECONDS == rotationPolicy) {
if (RotationPolicyEnum.per_seconds == rotationPolicy) {
LOGGER.info(" Rotation delay: {}", delay);
}
LOGGER.info(" Algorithms: {}", algorithms);
} else {
LOGGER.info("Hash configuration disabled, used only `none` pepper.");
}
}
public enum Algorithm {
NONE,
SHA256
none,
sha256
}
public enum RotationPolicyEnum {
PER_REQUESTS,
PER_SECONDS
per_requests,
per_seconds
}
public enum HashStorageEnum {
IN_MEMORY,
SQL
in_memory,
sql
}
public boolean isEnabled() {