Skip to content

Commit cc32bfd

Browse files
author
Sachin Maheshwari
committed
restricting sso user to reset password
1 parent e0a5576 commit cc32bfd

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)