Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update how external uids are retrieved #8505

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions jans-casa/extras/casa-external_otp.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ def findEnrollments(self, user_name, otpType, skipPrefix = True):
print "OTP. Find enrollments. Failed to find user"
return result

user_custom_ext_attribute = userService.getCustomAttribute(user, "jansExtUid")
if user_custom_ext_attribute == None:
extUids = user.getExternalUid()
if extUids == None:
return result

#otp_prefix = "%s:" % self.otpType
otp_prefix = "%s:" % otpType

otp_prefix_length = len(otp_prefix)
for user_external_uid in user_custom_ext_attribute.getValues():
for user_external_uid in extUids:
index = user_external_uid.find(otp_prefix)
if index != -1:
if skipPrefix:
Expand Down Expand Up @@ -449,7 +449,6 @@ def processOtpAuthentication(self, requestParameters, user_name, identity, otp_a
# print "OTP. Process OTP authentication. There is no OTP enrollment for user '%s'" % user_name
# facesMessages.add(FacesMessage.SEVERITY_ERROR, "There is no valid OTP user enrollments")
# return False

if len(user_enrollments) > 0:
for user_enrollment in user_enrollments:
user_enrollment_data = user_enrollment.split(";")
Expand All @@ -474,7 +473,6 @@ def processOtpAuthentication(self, requestParameters, user_name, identity, otp_a
print "OTP. Process HOTP authentication during authentication. Failed to update user entry"

user_enrollments = self.findEnrollments(user_name, "totp")

if len(user_enrollments) > 0:
for user_enrollment in user_enrollments:
otp_secret_key = self.fromBase64Url(user_enrollment)
Expand Down