70 def authenticate(self, configurationAttributes, requestParameters, step):
71 userService = CdiUtil.bean(UserService)
72 authenticationService = CdiUtil.bean(AuthenticationService)
74 identity = CdiUtil.bean(Identity)
76 iw_api_uri = configurationAttributes.get(
"iw_api_uri").getValue2()
77 iw_service_id = configurationAttributes.get(
"iw_service_id").getValue2()
78 iw_helium_enabled = Boolean(configurationAttributes.get(
"iw_helium_enabled").getValue2()).booleanValue()
80 if (iw_helium_enabled):
81 identity.setWorkingParameter(
"iw_count_login_steps", 1)
83 credentials = identity.getCredentials()
85 user_name = credentials.getUsername()
88 print "InWebo. Authenticate for step 1" 90 print "InWebo. Authenticate for step 1. iw_helium_enabled:", iw_helium_enabled
91 user_password = credentials.getPassword()
92 if (iw_helium_enabled):
93 login_array = requestParameters.get(
"login")
94 if ArrayHelper.isEmpty(login_array):
95 print "InWebo. Authenticate for step 1. login is empty" 98 user_name = login_array[0]
100 password_array = requestParameters.get(
"password")
101 if ArrayHelper.isEmpty(password_array):
102 print "InWebo. Authenticate for step 1. password is empty" 105 user_password = password_array[0]
107 response_validation = self.validateInweboToken(iw_api_uri, iw_service_id, user_name, user_password)
108 if (
not response_validation):
112 if (StringHelper.isNotEmptyString(user_name)):
113 userService = CdiUtil.bean(UserService)
114 logged_in = authenticationService.authenticate(user_name)
119 if (StringHelper.isNotEmptyString(user_name)
and StringHelper.isNotEmptyString(user_password)):
120 userService = CdiUtil.bean(UserService)
121 logged_in = authenticationService.authenticate(user_name, user_password)
127 print "InWebo. Authenticate for step 2" 129 passed_step1 = self.isPassedDefaultAuthentication
130 if (
not passed_step1):
133 iw_token_array = requestParameters.get(
"iw_token")
134 if ArrayHelper.isEmpty(iw_token_array):
135 print "InWebo. Authenticate for step 2. iw_token is empty" 138 iw_token = iw_token_array[0]
140 response_validation = self.validateInweboToken(iw_api_uri, iw_service_id, user_name, iw_token)
142 return response_validation