A Simple Authentication Problem ? - Forum - Mobile - Progress Community

A Simple Authentication Problem ?

 Forum

A Simple Authentication Problem ?

  • I set up an authentication with oeablSecurity-form-oerealm.xml.  I worked well, but now I get error:

    result for 88.113.172.165:8810/.../hhMobileService.json: 3
        Error: Error retrieving catalog '88.113.172.165:8810/.../hhMobileService.json'. Http status: 0.

    - - -
    When I test directly from:

    88.113.172.165:8810/.../hhMobileService.json, I am directed to a page 88.113.172.165:8810/.../login.html.  
    When I input correct userid/password combination, authentication goes into ABL program at AppServer and gives me the json file.

    The simple question:

    How should I change jsdoSettings?

            "catalogURIs": "88.113.172.165:8810/.../hhMobileService.json",
            "authenticationModel": "form",

    Should I put userid/password here ?

  • Check if the code below can help you

       var serviceURI = 88.113.172.165:8810/.../
    
         jsdoSettings = {
    
         serviceURI : serviceURI,
    
              catalogURIs : serviceURI + '/static/hhMobileService.json;
    
          authenticationModel : progress.data.Session.AUTH_TYPE_FORM};
    var JSDOSession = new progress.data.JSDOSession(jsdoSettings); JSDOSession.login(credentials.username, credentials.password);
  • In addition to trying the suggestion from Matheus, bring up the debug console of the browser you are testing with -- there may be error messages that have more information.

    Also look at the debugger's Network tab to see the messages sent between your client and your service. You should see:

    - GET of home,html that returns a 401 error (expected)

    - POST to j_spring_security_check that returns a 200

    - GET of .../hhMobileService.json  

    (you may also see a GET of _oeping somewhere)

  • Hello.
     
    I have used the CRUD Example from Progress as a model.  My comments are after "=>".
     
    ----------------------------------
    In the code I have:
     
                    promise = app.jsdosession.login(this.get("username"), this.get("password"));
                   
                    alert($(username).val());
                    alert($(password).val());
     
    => username and password are correctly set.
     
    promise.done( function( jsdosession, result, info ) {
        try {
            console.log("Success on login()");  
            that.set("isLoggedIn", true);
            app.viewModels.loginViewModel.loginViewTitle = app.viewModels.loginViewModel.logoutLabel;
            app.viewModels.loginViewModel.onBeforeShow( );
            var catPromise = jsdosession.addCatalog(jsdoSettings.catalogURIs);
            catPromise.done( function( jsdosession, result, details ) {
                console.log("Success on addCatalog()");
                if (!app.isAnonymous() && app.viewModels.loginViewModel) {
                    app.viewModels.loginViewModel.onBeforeShow();
                    app.changeTitle(app.viewModels.loginViewModel.logoutLabel);
                }
             });
           
            catPromise.fail( function( jsdosession, result, details) {
                app.viewModels.loginViewModel.addCatalogErrorFn(app.jsdosession,
                                        progress.data.Session.GENERAL_FAILURE, details);
            }); 
        }
        catch(ex) {
            details = [{"catalogURI": jsdoSettings.catalogURIs, errorObject: ex}];
            app.viewModels.loginViewModel.addCatalogErrorFn(app.jsdosession,
                                        progress.data.Session.GENERAL_FAILURE, details);
        }
     
    });
     
     
    ---------------------------------
    From Console log:
     
    Success on login()
     
    => login is done correctly.
     
    progress.jsdo.js:9402
     
    => I think this is not crucial.
     
    Default ping target not available, will use loginTarget instead.
     
    loginViewModel.js:130
     
    Error on addCatalog()
     
    => This is crucial, and I cannot use the application.
     
        null
    loginViewModel.js:99
     
    Success on logout()
     
    => So because I cannot addCatalog, I cannot login.
     
    -------------------------------------------
     
    As you can see, at the moment of addCatalog() I am logged in, but I cannot addCatalog.
     
    Regards
     
    - teppo
     
    ---------------------------|--------------------
    Teppo Määttänen____| TR-Tiimi Oy
    Consultant_________| Struerintie 1
    teppo @ trtiimi.fi____| 30100 FORSSA
    int-358-50-5748 226 | www.trtiimi.fi
    ---------------------------|--------------------
     
  • Hi Teppo,

    Please use the Network tab of the debugger to capture the request and response headers for:

    1. the POST of j_spring_security_check  (that is the login)

    2. the GET of hhMobileService.json

    and post them to this thread.

    You can get the headers by:

    1. right-click on the j_spring_security_check request and choose "Copy request headers"

    2. paste that

    3. right click again and choose "Copy response headers" and paste that.

    4. Repeat the above for the GET of the catalog.

    Alternatively, you could use Fiddler to save the network traffic to a .saz file and attach that.

    Regards,

    --Wayne

  • Hi Teppo,
     
    Please use the Network tab of the debugger to capture the request and response headers for:
     
    1. the POST of j_spring_security_check  (that is the login)
     
    2. the GET of hhMobileService.json
     
    and post them to this thread.
     
    =>
     
    All request headers after pressing login button (they are 6 and 2 last are repeated: first with success then with failure):
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Access-Control-Request-Method: GET
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Access-Control-Request-Headers: accept, cache-control, pragma
    Accept: */*
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Pragma: no-cache
    Accept: application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Cache-Control: no-cache
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: JSESSIONID=885EF110001C16D66D6D5F485D74B6D464CC0D23490C.oepas1
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Access-Control-Request-Method: GET
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Access-Control-Request-Headers: accept, cache-control, pragma
    Accept: */*
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Access-Control-Request-Method: GET
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Access-Control-Request-Headers: accept, cache-control, pragma
    Accept: */*
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Pragma: no-cache
    Accept: application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Cache-Control: no-cache
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: JSESSIONID=885EF110001C16D66D6D5F485D74B6D464CC0D23490C.oepas1
     
    Host: 88.113.172.165:8810
    Proxy-Connection: keep-alive
    Pragma: no-cache
    Accept: application/json
    Cache-Control: no-cache
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: JSESSIONID=885EF110001C16D66D6D5F485D74B6D464CC0D23490C.oepas1
     
    Response headers (same six):
     
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Allow-Methods: DELETE, POST, GET, OPTIONS, PUT
    Access-Control-Allow-Headers: Access-Control-Request-Headers, Accept-Language, Content-Language, Authorization, Origin, Access-Control-Request-Method, Content-Type, Accept, X-Client-Context-Id, Cache-Control, Pragma
    Content-Length: 0
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Expose-Headers: Content-Language, Expires, Last-Modified, Content-Type, X-Client-Context-Id, Pragma, Cache-Control
    Accept-Ranges: bytes
    ETag: W/"35-1460032024000"
    Last-Modified: Thu, 07 Apr 2016 12:27:04 GMT
    Content-Type: text/html
    Content-Length: 35
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Allow-Methods: DELETE, POST, GET, OPTIONS, PUT
    Access-Control-Allow-Headers: Access-Control-Request-Headers, Accept-Language, Content-Language, Authorization, Origin, Access-Control-Request-Method, Content-Type, Accept, X-Client-Context-Id, Cache-Control, Pragma
    Content-Length: 0
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Allow-Methods: DELETE, POST, GET, OPTIONS, PUT
    Access-Control-Allow-Headers: Access-Control-Request-Headers, Accept-Language, Content-Language, Authorization, Origin, Access-Control-Request-Method, Content-Type, Accept, X-Client-Context-Id, Cache-Control, Pragma
    Content-Length: 0
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    HTTP/1.1 401 Unauthorized
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Expose-Headers: Content-Language, Expires, Last-Modified, Content-Type, X-Client-Context-Id, Pragma, Cache-Control
    Content-Type: application/json.*;charset=ISO-8859-1
    Content-Length: 57
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    HTTP/1.1 401 Unauthorized
    Server: Apache-Coyote/1.1
    Access-Control-Allow-Origin: http://app.icenium.com
    Access-Control-Allow-Credentials: true
    Access-Control-Expose-Headers: Content-Language, Expires, Last-Modified, Content-Type, X-Client-Context-Id, Pragma, Cache-Control
    Content-Type: application/json.*;charset=ISO-8859-1
    Content-Length: 57
    Date: Thu, 14 Apr 2016 12:25:06 GMT
     
    ----
     
    You can get the headers by:
     
    1. right-click on the j_spring_security_check request and choose "Copy request headers"
     
    2. paste that
     
    3. right click again and choose "Copy response headers" and paste that.
     
    4. Repeat the above for the GET of the catalog.
     
    Alternatively, you could use Fiddler to save the network traffic to a .saz file and attach that.
     
    => teppo.saz included.
     
    Regards,
     
    --Wayne
     
    =>
     
    Regards
     
    - teppo
     
    ---------------------------|--------------------
    Teppo Määttänen____| TR-Tiimi Oy
    Consultant_________| Struerintie 1
    teppo @ trtiimi.fi____| 30100 FORSSA
    int-358-50-5748 226 | www.trtiimi.fi
    ---------------------------|--------------------
     
  • It is surprising that the GET request for home.html already includes a JSESSIONID -- did you successfully access the Web application from the same browser session before you ran the test? Another question -- are you using OpenEdge 11.6.0, the FCS? There is a bug in it that causes an error when you try to access an OE Web application using CORS, if the application uses Form authentication. The symptoms are not exactly what you are seeing, but if you are using 11.6.0 and can upgrade to 11.6.1, that might be worth a try.

  • Hello.
     
    Unfortunately I have 11.5.1.
     
    * * *
     
    I changed to
     
    "authenticationModel": "for", => "authenticationModel": "basic",
     
    updated oeablSecurity-basic-oerealm.xml
     
    and got rid of the problem.
     
    Regards and thank you
     
    - teppo
     
    ---------------------------|--------------------
    Teppo Määttänen____| TR-Tiimi Oy
    Consultant_________| Struerintie 1
    teppo @ trtiimi.fi____| 30100 FORSSA
    int-358-50-5748 226 | www.trtiimi.fi
    ---------------------------|--------------------