Topic
  • 2 replies
  • Latest Post - ‏2012-06-20T08:20:16Z by SystemAdmin
SystemAdmin
SystemAdmin
570 Posts

Pinned topic Adapter-based authenticator failed with onStartup

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

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.
Daniel
  • AntonAleksandrov
    AntonAleksandrov
    22 Posts

    Re: Adapter-based authenticator failed with onStartup

    ‏2012-06-20T07:23:01Z  
    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
    SystemAdmin
    570 Posts

    Re: Adapter-based authenticator failed with onStartup

    ‏2012-06-20T08:20:16Z  
    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 .
    Hi,

    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:
    http://localhost:8080/apps/services/apps/services/api/MyApp/common/0/login?realm=MyRealm&jsessionid=546425C2067157CD17C5AD21BB5EE060

    thanks for any advances
    Daniel,