use of dev.samstevens.totp.exceptions.CodeGenerationException in project CzechIdMng by bcvsolutions.
the class DefaultTwoFactorAuthenticationManager method generateCode.
@Override
public GuardedString generateCode(GuardedString verificationSecret) {
Assert.notNull(verificationSecret, "Verification secret is required.");
//
long currentBucket = Math.floorDiv(timeProvider.getTime(), props.getTime().getPeriod());
try {
return new GuardedString(codeGenerator.generate(verificationSecret.asString(), currentBucket));
} catch (CodeGenerationException ex) {
throw new ResultCodeException(CoreResultCode.TWO_FACTOR_GENERATE_CODE_FAILED, ex);
}
}
Aggregations