Skip to content

Commit

Permalink
Credential Lockout Policy fix
Browse files Browse the repository at this point in the history
fixes #855, fixes #856, fixes #857

Signed-off-by: Claudio Mezzasalma <claudio.mezzasalma@eurotech.com>
  • Loading branch information
Claudio Mezzasalma committed Nov 7, 2017
1 parent 0dded69 commit 625e777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authent
// Check if lockout policy is blocking credential
Map<String, Object> credentialServiceConfig;
try {
credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getScopeId()));
credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getId()));
boolean lockoutPolicyEnabled = (boolean) credentialServiceConfig.get("lockoutPolicy.enabled");
if (lockoutPolicyEnabled) {
Date now = new Date();
Expand Down Expand Up @@ -240,6 +240,7 @@ protected void assertCredentialsMatch(AuthenticationToken authcToken, Authentica
Credential credential = (Credential) kapuaInfo.getCredentials();
credential.setFirstLoginFailure(null);
credential.setLoginFailuresReset(null);
credential.setLockoutReset(null);
credential.setLoginFailures(0);
try {
KapuaSecurityUtils.doPrivileged(() -> credentialService.update(credential));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authent
// Check if lockout policy is blocking credential
Map<String, Object> credentialServiceConfig;
try {
credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getScopeId()));
credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getId()));
boolean lockoutPolicyEnabled = (boolean) credentialServiceConfig.get("lockoutPolicy.enabled");
if (lockoutPolicyEnabled) {
Date now = new Date();
Expand Down Expand Up @@ -245,6 +245,7 @@ protected void assertCredentialsMatch(AuthenticationToken authcToken, Authentica
Credential credential = (Credential) kapuaInfo.getCredentials();
credential.setFirstLoginFailure(null);
credential.setLoginFailuresReset(null);
credential.setLockoutReset(null);
credential.setLoginFailures(0);
try {
KapuaSecurityUtils.doPrivileged(() -> credentialService.update(credential));
Expand Down

0 comments on commit 625e777

Please sign in to comment.