mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-25 16:42:34 +00:00
KEYCLOAK-2119
OTP Policy form validates both TOTP and HOTP at the same time
This commit is contained in:
@@ -69,12 +69,12 @@ public class RepresentationToModel {
|
||||
private static Logger logger = Logger.getLogger(RepresentationToModel.class);
|
||||
public static OTPPolicy toPolicy(RealmRepresentation rep) {
|
||||
OTPPolicy policy = new OTPPolicy();
|
||||
policy.setType(rep.getOtpPolicyType());
|
||||
policy.setLookAheadWindow(rep.getOtpPolicyLookAheadWindow());
|
||||
policy.setInitialCounter(rep.getOtpPolicyInitialCounter());
|
||||
policy.setAlgorithm(rep.getOtpPolicyAlgorithm());
|
||||
policy.setDigits(rep.getOtpPolicyDigits());
|
||||
policy.setPeriod(rep.getOtpPolicyPeriod());
|
||||
if (rep.getOtpPolicyType() != null) policy.setType(rep.getOtpPolicyType());
|
||||
if (rep.getOtpPolicyLookAheadWindow() != null) policy.setLookAheadWindow(rep.getOtpPolicyLookAheadWindow());
|
||||
if (rep.getOtpPolicyInitialCounter() != null) policy.setInitialCounter(rep.getOtpPolicyInitialCounter());
|
||||
if (rep.getOtpPolicyAlgorithm() != null) policy.setAlgorithm(rep.getOtpPolicyAlgorithm());
|
||||
if (rep.getOtpPolicyDigits() != null) policy.setDigits(rep.getOtpPolicyDigits());
|
||||
if (rep.getOtpPolicyPeriod() != null) policy.setPeriod(rep.getOtpPolicyPeriod());
|
||||
return policy;
|
||||
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class RealmAdminResource {
|
||||
} catch (ModelDuplicateException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
logger.error(e.getMessage(), e);
|
||||
return ErrorResponse.error("Failed to update " + rep.getRealm() + " Realm.", Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user