in service/src/main/java/org/apache/fineract/cn/identity/internal/command/handler/AuthenticationCommandHandler.java [164:207]
public AuthenticationCommandResponse process(final PasswordAuthenticationCommand command)
throws AmitAuthenticationException
{
final byte[] base64decodedPassword;
try {
base64decodedPassword = Base64Utils.decodeFromString(command.getPassword());
}
catch (final IllegalArgumentException e)
{
throw ServiceException.badRequest("Password was not base64 encoded.");
}
final PrivateTenantInfoEntity privateTenantInfo = checkedGetPrivateTenantInfo();
final PrivateSignatureEntity privateSignature = checkedGetPrivateSignature();
byte[] fixedSalt = privateTenantInfo.getFixedSalt().array();
final UserEntity user = getUser(command.getUseridentifier());
if (!this.hashGenerator.isEqual(
user.getPassword().array(),
base64decodedPassword,
fixedSalt,
user.getSalt().array(),
user.getIterationCount(),
256))
{
throw AmitAuthenticationException.userPasswordCombinationNotFound();
}
final TokenSerializationResult refreshToken = getRefreshToken(user, privateSignature);
final AuthenticationCommandResponse ret = getAuthenticationResponse(
applicationName.toString(),
Optional.empty(),
privateTenantInfo,
privateSignature,
user,
refreshToken.getToken(),
refreshToken.getExpiration());
fireAuthenticationEvent(user.getIdentifier());
return ret;
}