IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2012-06-20T08:20:16Z by SystemAdmin
570 Posts

Pinned topic Adapter-based authenticator failed with onStartup

‏2012-06-20T05:16:14Z |

My adapter-based authenticator works fine in onDemand authentication, but when I change it to onStartup, it don't call procedure for login purpose of my adapter, i.e. at first time, authRequired = true, client side show login page, after login button clicked, it try to call login procedure of my adapter, but it seems that worklight server don't call expected procedure (named login) of my adapter, the adapter is configured to give login procedure authenticationRequired = false, target procedure don't execute and client-side received OK status but response.authRequired is still true.
After I changed authentication mode to onDemand, then OK, but my app required to use onStartup authentication, I read worklight 4.2.1 tutorial - adapter-based authentication section again, the sample use onDemand only. Does anybody know what's wrong?

thanks for your hits.
  • AntonAleksandrov
    22 Posts

    Re: Adapter-based authenticator failed with onStartup

    ‏2012-06-20T07:23:01Z  in response to SystemAdmin
    Hello Daniel,

    Adapter based authentication will not function with onStartup setting.
    onStartup means that your application has to authenticate to be able to gain access to adapters in the first place. So, your in a loop here - you need to authenticate to be able to invoke adapters, but you need to be able to invoke adapters in order to authenticate.
    Therefore currently only option to use adapter based authentication is with onDemand setting.
    You can use WL.Client.login("your-realm-name") in your JavaScript to invoke authentication sequence on applications startup .
    • SystemAdmin
      570 Posts

      Re: Adapter-based authenticator failed with onStartup

      ‏2012-06-20T08:20:16Z  in response to AntonAleksandrov

      Thanks Anton a lot,

      Now I see the error, I changed to use onDemand authentication, and call WL.Client.login('MyRealm') in wlCommonInit() to trigger login process, it open a browser window with error, I checked the URL, it seems that /apps/services in the URL is concatenated twice, in my pages, only one <base /> tag which is generated by worklight builder.
      In my application-descriptor.xml, the <worklightRootURL /> is http://localhost:8080, I changed it to http://localhost:8080/ (add a slash), still get wrong URL.

      Does anybody know which setting is wrong?

      WL.Client.login('MyRealm') open the problematic URL:

      thanks for any advances