Topic
9 replies Latest Post - ‏2012-11-08T16:52:56Z by sanjeevm
SystemAdmin
SystemAdmin
2327 Posts
ACCEPTED ANSWER

Pinned topic Finding information on porting App to new 5.0.0.3 authentication model

‏2012-08-27T17:44:33Z |
Hi -- we just upgraded our Worklight plugin to 5.0.0.3, and it seems to have broken our application.

It edited our custom authentication module, and our Adapter. We are now no longer able to authenticate, and everything was working in 5.0.0.2.

The entry added to our auth.js file states that we should look to the Worklight documentation -- could someone point me to something more specific?
Thanks,
Greg
  • SystemAdmin
    SystemAdmin
    2327 Posts
    ACCEPTED ANSWER

    Re: Finding information on porting App to new 5.0.0.3 authentication model

    ‏2012-08-27T20:22:16Z  in response to SystemAdmin
    Hi Greg,

    One of the developers may be able to provide more details on the specifics of what changed. At a high level the authentication changes made in 5.0.0.3 are:

    • Improved authentication protocol. The goal is to reduce the number of round-trips between client and server and allow flexibility when defining the various Worklight security settings.
      • The change requires various changes to application definition files. These files are automatically upgraded when the project is opened for the first time in the new Eclipse studio
      • There is a change in the wire protocol between client and server. A 5.0.0.2 (or earlier) server cannot be accessed from a 5.0.0.3 client and vice versa. Such mobile-client access would result in a "Deny App" message.

    And you can find docs here.


    Barbara Hampson, Manager, IBM Worklight
  • IdanAdar
    IdanAdar
    741 Posts
    ACCEPTED ANSWER

    Re: Finding information on porting App to new 5.0.0.3 authentication model

    ‏2012-08-28T04:35:30Z  in response to SystemAdmin
    Greg,
    Please post any specific messages printed while trying to deploy. It will help us be able to help you...

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
  • VV3R_mordechai_taitelman
    43 Posts
    ACCEPTED ANSWER

    Re: Finding information on porting App to new 5.0.0.3 authentication model

    ‏2012-08-28T06:09:14Z  in response to SystemAdmin
    Hi Greg
    externally the xml schemas were changed + few java script changes.
    so the old xml should have been upgraded to the new format.
    What I fear though is that the old auth.js will not work as you expect.
    The new samples show how a "new" 5.0.0.3 auth.js should look like.
    Greg , please contact me via ST.
    • SystemAdmin
      SystemAdmin
      2327 Posts
      ACCEPTED ANSWER

      Re: Finding information on porting App to new 5.0.0.3 authentication model

      ‏2012-08-28T14:29:37Z  in response to VV3R_mordechai_taitelman
      Hi Mordechai,

      I reset my project back to its original files (via git), started a completely new workspace, and let the project be re-migrated again.

      I actually had better success on the second attempt, and was allowed to login after the second migration. However, on initial login, I have errors in the server logs, and I have an error message on the UI. And, it appears that one of our adapter's methods no longer work (but some do).

      Here are the errors I got on the WL console:

      2012-08-28 09:24:16 Unhandled exception caught: java.lang.IllegalStateException: realm wl_deviceNoProvisioningRealm is not allowed to ignore request to a protected resouce in a non-success state
      2012-08-28 09:24:16 /apps/services/api/BPMApp/iphone/query
      2012-08-28 09:24:16 Unhandled exception caught: java.lang.IllegalStateException: realm wl_deviceNoProvisioningRealm is not allowed to ignore request to a protected resouce in a non-success state
      2012-08-28 09:24:16 /apps/services/api/BPMApp/iphone/query
      2012-08-28 09:24:16 Unhandled exception caught: java.lang.IllegalStateException: realm wl_deviceNoProvisioningRealm is not allowed to ignore request to a protected resouce in a non-success state
      2012-08-28 09:24:16 /apps/services/api/BPMApp/iphone/init
      2012-08-28 09:24:17 BPM Adapter getUserAttributes
      2012-08-28 09:24:17 An error occurred while invoking procedure BPMAdapter/getUserAttributes parameters: {
      "arr": [
      ]
      }
      TypeError: Cannot find default value for object. (M%3A%5Cdevel%5Cworkspaces%5Cmobile%5Crepo%5Csrc%5CBPMWorklight%5Cadapters%5CBPMAdapter/BPMAdapter-impl.js#80)
      Caused by: null

      "getUserAttributes" is a method we use to get some of the user preferences, which we set from our custom login module when the user logs in.

      I will contact you directly about these problems, but wanted to document them here for completeness.

      Cheers,
      Greg
      • tiny_gipxy
        tiny_gipxy
        15 Posts
        ACCEPTED ANSWER

        Re: Finding information on porting App to new 5.0.0.3 authentication model

        ‏2012-08-31T03:20:19Z  in response to SystemAdmin
        hello, I got the same error with you. Did you fix it ?

        Thank you for your help!
  • MattThornhill
    MattThornhill
    2 Posts
    ACCEPTED ANSWER

    Re: Finding information on porting App to new 5.0.0.3 authentication model

    ‏2012-09-01T13:45:50Z  in response to SystemAdmin
    I have been having similar problems with the new authentication model. The application is set up to use WAS authentication and uses an embedded login and worked in 5.0.0.2.

    The first issue I had was a "Uncaught TypeError: Cannot read property 'userInfo' of null" error listed in the JavaScript console, generated after the first init call after authentication. This was being caused by the content-type header not being set on the server side for all worklight API calls after authentication (causing the responseJSON property to be null). As a work-around I have added the following to the if statement in the _getResponseJSON function in common/js/base.js (in the application deployable):

    && !(this.responseText.indexOf("/*-secure") >= 0)

    This will make it treat all responses containing "/*-secure" as JSON. This is a bit of a hack but is working for now until I can find out why the content type is not being set.

    The second issue is the one mentioned in this thread, I keep getting "java.lang.IllegalStateException: realm WASLTPARealm is not allowed to ignore request to a protected resouce in a non-success state" errors. I have been testing using a web application, and it will work correctly if you log in straight away. If you visit the login page without logging in however, when you next visit the login page (or refresh) that error occurs. Clearing cookies (specifically the JSESSIONID cookie) allows it to work again.
    • SystemAdmin
      SystemAdmin
      2327 Posts
      ACCEPTED ANSWER

      Re: Finding information on porting App to new 5.0.0.3 authentication model

      ‏2012-09-04T04:02:46Z  in response to MattThornhill
      Hi

      2 items:

      1) I downloaded all of the developer reference PDFs, had had been suggested. However, it does not appear that the developers reference doc has actually been updated with any information on the new security model. It would be great if someone could let us know when that happens.

      2) I haven't fixed my problem yet, but a suggested solution was to basically reset the security test to be the "custom" one for all devices and web preview. But I'm having problems doing that -- when I try to set the iphone and android devices to use the generated "custom" security test, I get this error in my logs:

      2012-09-03 23:42:25 Unhandled exception caught: java.lang.RuntimeException: Security test BPMAdapter-securityTest must include user and device realms for BPMApp:iphone:1.0:api.

      I'm guessing I'm missing some of the xml here required to complete the change.

      Cheers,
      Greg
      • sanjeevm
        sanjeevm
        3 Posts
        ACCEPTED ANSWER

        Re: Finding information on porting App to new 5.0.0.3 authentication model

        ‏2012-11-08T16:52:56Z  in response to SystemAdmin
        Have you been able to fix the issue related to Security Test. I'm getting the same error when I try to run the app in device simulator (works fine in the web view)
        2012-11-07 12:54:12 Unhandled exception caught: java.lang.IllegalStateException: realm wl_deviceNoProvisioningRealm is not allowed to ignore request to a protected resouce in a non-success state

        Tried to change it to Custom realm but that doesn't work either (same error as you've mentioned).
        All of this use to work fine in 5.0.0.2 version but the newer version, something is broke or the documentation is not explaining what we need to change.
  • IdanAdar
    IdanAdar
    741 Posts
    ACCEPTED ANSWER

    Re: Finding information on porting App to new 5.0.0.3 authentication model

    ‏2012-09-04T04:24:01Z  in response to SystemAdmin
    Please see if the following information helps you progress any further:
    http://www.ibm.com/developerworks/forums/thread.jspa?threadID=453689&tstart=0

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform