By: Serkan Yıldırım user 12 Feb 2016 at 3:29 a.m. CST

8 Responses
Serkan Yıldırım gravatar
Hi, I wrote a custom auth script and page. It is not complex, it is the same as [Sample Basic Script](https://github.com/GluuFederation/oxAuth/blob/master/Server/integrations/basic/BasicExternalAuthenticator.py) only logs printed are different. I use gluu-server-2.4.1. When i first open the auth page, prepareForStep method in script is not executed. I could not see any log in the oxauth_script log file under tomcat/logs. However, when i enter wrong username/password in the form and submit them, prepareForStep is executed and i could see the logs. So why prepareForStep method is not executed before first rendering of the auth page? My prepareForStep and pageForStep methods are like below: def prepareForStep(self, configurationAttributes, requestParameters, step): context = Contexts.getEventContext() sessionStateService = SessionStateService.instance() sessionState = sessionStateService.getSessionState() print "SessionState id: %s" % sessionState.getId() print "AkisIDExternalAuthenticator. Prepare for Step initialization" if (step == 1): nonceB64Encoded = self.produceNonce() context.set("nonce", nonceB64Encoded) captchaBase64Encoded, captchaImageB64Encoded = self.produceCaptchaImage() context.set("akisCaptchaImage", captchaImageB64Encoded) sessionAttributes = sessionState.getSessionAttributes() sessionAttributes.put("captcha", captchaBase64Encoded) sessionState.setSessionAttributes(sessionAttributes) sessionStateService.updateSessionState(sessionState) print "AkisIDExternalAuthenticator. Prepare for Step 1" return True else: return False def getPageForStep(self, configurationAttributes, step): if step == 1: print "AkisIDExternalAuthenticator Page For Step 1" return "/auth/akis/akis.login.xhtml" return ""

By Aliaksandr Samuseu staff 12 Feb 2016 at 11:57 a.m. CST

Aliaksandr Samuseu gravatar
Hi, Serkan. > I could not see any log in the oxauth_script log file under tomcat/logs. Please enclose all fragments of the original code you've modified in "try" blocks, like this: try: ... some block of code you modified ... except Exception, ex: print "Debugging inlet #1" print "Unexpected error:", ex ...then try to monitor the oxauth_script.log again. This may help to uncover additional clues on what is going wrong.

By Aliaksandr Samuseu staff 16 Feb 2016 at 12:51 p.m. CST

Aliaksandr Samuseu gravatar
Hi, Serkan. May we close this ticket now?

By Serkan Yıldırım user 16 Feb 2016 at 2 p.m. CST

Serkan Yıldırım gravatar
Hi Aliaksandr, I could try it on friday because of mass in the work. Sorry for that. Could this issue open till saturday?

By Aliaksandr Samuseu staff 16 Feb 2016 at 2:23 p.m. CST

Aliaksandr Samuseu gravatar
Sure, we'll be waiting for your report then.

By Yuriy Movchan staff 17 Feb 2016 at 5:52 a.m. CST

Yuriy Movchan gravatar
I've one question about `/auth/akis/akis.login.xhtml` Did you add `/auth/akis/akis.login.page.xml` too ? In this page.xml you should call: ```<action execute="#{authenticator.prepareAuthenticationForStep}" on-postback="false" if="#{not identity.loggedIn}"></action>``` Example: [Basic page.xml](https://github.com/GluuFederation/oxAuth/blob/master/Server/src/main/webapp/login.page.xml#L7)

By Aliaksandr Samuseu staff 18 Feb 2016 at 12:16 p.m. CST

Aliaksandr Samuseu gravatar
May I also ask you to provide complete code of your script and the page for a check? You can use any file sharing services you find convenient for that if you don't have access to attachment feature on the boards.

By Serkan Yıldırım user 19 Feb 2016 at 2:33 a.m. CST

Serkan Yıldırım gravatar
You can reacht them by following the link: https://www.dropbox.com/sh/giz0glvokrmnzhr/AAAjrzyiXAD9jKbXwfMbDnifa?dl=0

By Serkan Yıldırım user 19 Feb 2016 at 9:51 a.m. CST

Serkan Yıldırım gravatar
HiYuriy, Your suggestion works !!! Thank you, continue to develop...