By: Burcin Gunay named 26 Apr 2018 at 3:40 a.m. CDT

5 Responses
Burcin Gunay gravatar
We have a custom authentication script developed in Gluu 2.4.4.sp2 on Centos 7. We have a custom attribute "ID" that is defined for a person. In the code, ``` def authenticate(self, configurationAttributes, requestParameters, step): context = Contexts.getEventContext() sessionStateService = SessionStateService.instance() sessionState = sessionStateService.getSessionState() sessionAttributes = sessionState.getSessionAttributes() print "AkisIDExternalAuthenticator. Authenticate. Session State ID: %s" % sessionState.getId() context.set("keyOpErrorMsg", "") if (step == 1): print "AkisIDExternalAuthenticator. Authenticate for step 1" ''' Getting captcha from request ''' logged_in = False tckn = eCertificate.getSubject().getSerialNumberAttribute() print "TCKN = %s" % tckn if (StringHelper.isNotEmptyString(tckn)): userService = UserService.instance() authenticationService = AuthenticationService.instance() #logged_in = userService.authenticate(tckn) logged_in = authenticationService.authenticate(tckn) print "AuthenticationService is initialized %s" % logged_in print "Logged in %s" % logged_in if (not logged_in): nameSurname = eCertificate.getSubject().getCommonNameAttribute() print "NameSurnameFromServer: %s" % nameSurname context.set("registerMsg", "Kimlik dogrulama basarisiz !!!") context.set("tckk_count_login_steps", 2) context.set("tcknFromServer", tckn) context.set("nameSurnameFromServer", nameSurname) return True ``` authenticationService.authenticate(tckn) always returns false. It is for sure that a person with tckn custom attribute is already defined. Same holds for userService.authenticate(tckn)

By Michael Schwartz Account Admin 26 Apr 2018 at 3:48 a.m. CDT

Michael Schwartz gravatar
You're going to have to debug this yourself. Add some print statements to send info to the logs, and go through it line by line. It could be throwing an error somewhere, which is resulting in your false result.

By Burcin Gunay named 26 Apr 2018 at 5:25 a.m. CDT

Burcin Gunay gravatar
How can I go into authenticate method? Because I have already debug it myself and see that Id (tckn) is already set and the code goes into if (not logged_in) block and returns false. In the log file, I can see that the print "NameSurnameFromServer: %s" % nameSurname is output. It is for sure that logged_in = authenticationService.authenticate(tckn) method returns false. Is there any place in the log where you right the reason of why the authentication returns false?

By William Lowe user 26 Apr 2018 at 8:28 a.m. CDT

William Lowe gravatar
Sorry, this is not covered in community support. If you would like further assistance, please consider purchasing a [support contract](https://gluu.org/pricing).

By Burcin Gunay named 27 Apr 2018 at 1:04 a.m. CDT

Burcin Gunay gravatar
Hi, I could not undestand how this problem is addressed to puchasing support. Let me explain the problem again, I am using AuthenticationService.authenticate to authenticate my user by the custom ID attribute defined in Gluu. By debuging myself, it is for sure that the authenticate method returns false although the user is already defined in Gluu. AuthenticationService.authenticate does not work properly and the reasoning about the “false” authentication is not available in the logs.

By Aliaksandr Samuseu staff 27 Apr 2018 at 4:20 a.m. CDT

Aliaksandr Samuseu gravatar
Hi. >I could not undestand how this problem is addressed to puchasing support. Community support doesn't cover custom script development questions. It usually involves consultations with the dev team, and we can't afford offering their time for free. All sources and custom scripts examples are available at our Github repo for study. You also may want to [rise logs' verbosity level](https://gluu.org/docs/ce/2.4.4/operation/logs/#log-levels).