Skip to content

Commit 26219ad

Browse files
author
sachin-maheshwari
authored
Merge pull request #27 from appirio-tech/feature/RS256-Auth0
New Auth Flow - Restricting SSO user to reset password.
2 parents e0a5576 + cc32bfd commit 26219ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/appirio/tech/core/service/identity/resource/UserResource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,11 @@ public ApiResponse changePassword(
820820
throw new APIRuntimeException(SC_UNAUTHORIZED, "Credentials are incorrect.");
821821
}
822822

823+
// SSO users can't reset their password.
824+
List<UserProfile> ssoProfiles = userDao.getSSOProfiles(Utils.toLongValue(user.getId()));
825+
if(ssoProfiles!=null && ssoProfiles.size()>0)
826+
throw new APIRuntimeException(HttpURLConnection.HTTP_FORBIDDEN, MSG_TEMPLATE_NOT_ALLOWED_TO_RESET_PASSWORD);
827+
823828
String error = user.validatePassoword();
824829
if (error != null) {
825830
throw new APIRuntimeException(SC_BAD_REQUEST, error);

0 commit comments

Comments
 (0)