Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomer2001 committed Jan 25, 2019
1 parent 0686f83 commit e620b84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Server/integrations/otp/OtpExternalAuthenticator.py
Expand Up @@ -5,7 +5,7 @@
#

# Requires the following custom properties and values:
# otp_type: totp/htop
# otp_type: totp/hotp
# issuer: Gluu Inc
# otp_conf_file: /etc/certs/otp_configuration.json
#
Expand Down Expand Up @@ -74,7 +74,7 @@ def init(self, configurationAttributes):
validOtpConfiguration = self.loadOtpConfiguration(configurationAttributes)
if not validOtpConfiguration:
return False

print "OTP. Initialized successfully"
return True

Expand Down Expand Up @@ -111,13 +111,13 @@ def authenticate(self, configurationAttributes, requestParameters, step):
#enrollment_mode = ServerUtil.getFirstValue(requestParameters, "loginForm:registerButton")
#if StringHelper.isNotEmpty(enrollment_mode):
# otp_auth_method = "enroll"

if otp_auth_method == "authenticate":
user_enrollments = self.findEnrollments(authenticated_user.getUserId())
if len(user_enrollments) == 0:
otp_auth_method = "enroll"
print "OTP. Authenticate for step 1. There is no OTP enrollment for user '%s'. Changing otp_auth_method to '%s'" % (authenticated_user.getUserId(), otp_auth_method)

if otp_auth_method == "enroll":
print "OTP. Authenticate for step 1. Setting count steps: '%s'" % 3
identity.setWorkingParameter("otp_count_login_steps", 3)
Expand Down Expand Up @@ -250,10 +250,10 @@ def getCountAuthenticationSteps(self, configurationAttributes):
def getPageForStep(self, configurationAttributes, step):
if step == 2:
identity = CdiUtil.bean(Identity)

otp_auth_method = identity.getWorkingParameter("otp_auth_method")
print "OTP. Gep page for step 2. otp_auth_method: '%s'" % otp_auth_method

if otp_auth_method == 'enroll':
return "/auth/otp/enroll.xhtml"
else:
Expand Down Expand Up @@ -291,10 +291,10 @@ def loadOtpConfiguration(self, configurationAttributes):
return False
finally:
f.close()

# Check configuration file settings
try:
self.hotpConfiguration = otpConfiguration["htop"]
self.hotpConfiguration = otpConfiguration["hotp"]
self.totpConfiguration = otpConfiguration["totp"]

hmacShaAlgorithm = self.totpConfiguration["hmacShaAlgorithm"]
Expand Down

0 comments on commit e620b84

Please sign in to comment.