Need to pass credentials from external site

Dear All,
I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.
I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {
            $("#link1").click(function () {
                $.post("http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true", { j_username: "admin", j_password: "district" });
                window.open("http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action");
            });
        });

please help.

Md Monjur Rahman
Senior Computer Programmer,
Center for Equity & Health System,
icdd,b, Mohakhali, Dhaka, Bangladesh.

Hi,

i test this on our demo server (http://apps.dhis2.org/dev) and this works fine:
$.post(’/dev/dhis-web-commons-security/login.action?authOnly=true’, { j_username: “admin”, j_password: “district” })

Is the request coming from the same server? remember that x-domain auth is not supported by default

···


Morten

On Thu, Jun 12, 2014 at 10:22 AM, Md. Monjur Rahman monjur@icddrb.org wrote:

Dear All,

I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.

I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {

        $("#link1").click(function () {

            $.post("[http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true](http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true)", { j_username: "admin", j_password: "district" });



            window.open("[http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action](http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action)");



        });

    });

please help.

Md Monjur Rahman

Senior Computer Programmer,

Center for Equity & Health System,

icdd,b, Mohakhali, Dhaka, Bangladesh.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Thanks Morten,
Is this the right section in the manual?

http://www.dhis2.org/doc/snapshot/en/implementer/html/ch08s03.html

Knut

···

On Thu, Jun 12, 2014 at 10:38 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

i test this on our demo server (http://apps.dhis2.org/dev) and this works fine:

$.post(’/dev/dhis-web-commons-security/login.action?authOnly=true’, { j_username: “admin”, j_password: “district” })

Is the request coming from the same server? remember that x-domain auth is not supported by default


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org


Morten

On Thu, Jun 12, 2014 at 10:22 AM, Md. Monjur Rahman monjur@icddrb.org wrote:

Dear All,

I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.

I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {

        $("#link1").click(function () {

            $.post("[http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true](http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true)", { j_username: "admin", j_password: "district" });





            window.open("[http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action](http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action)");





        });

    });

please help.

Md Monjur Rahman

Senior Computer Programmer,

Center for Equity & Health System,

icdd,b, Mohakhali, Dhaka, Bangladesh.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

That depends on what you want to do. That approach uses a apache/nginx authenticating proxy, and not JS.

It is possible to get around x-domain issues in JS using CORS [1] also (but not available in all browsers/versions).

Without knowing more of the setup, its hard to decide what is the best approach.

[1] http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

···


Morten

On Thu, Jun 12, 2014 at 11:38 AM, Knut Staring knutst@gmail.com wrote:

Thanks Morten,
Is this the right section in the manual?

http://www.dhis2.org/doc/snapshot/en/implementer/html/ch08s03.html

Knut

On Thu, Jun 12, 2014 at 10:38 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

i test this on our demo server (http://apps.dhis2.org/dev) and this works fine:

$.post(’/dev/dhis-web-commons-security/login.action?authOnly=true’, { j_username: “admin”, j_password: “district” })

Is the request coming from the same server? remember that x-domain auth is not supported by default


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org


Morten

On Thu, Jun 12, 2014 at 10:22 AM, Md. Monjur Rahman monjur@icddrb.org wrote:

Dear All,

I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.

I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {

        $("#link1").click(function () {

            $.post("[http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true](http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true)", { j_username: "admin", j_password: "district" });







            window.open("[http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action](http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action)");







        });

    });

please help.

Md Monjur Rahman

Senior Computer Programmer,

Center for Equity & Health System,

icdd,b, Mohakhali, Dhaka, Bangladesh.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

I think the point is that it is not the same server (it is several different servers)

···

On Thu, Jun 12, 2014 at 10:38 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

i test this on our demo server (http://apps.dhis2.org/dev) and this works fine:

$.post(’/dev/dhis-web-commons-security/login.action?authOnly=true’, { j_username: “admin”, j_password: “district” })

Is the request coming from the same server? remember that x-domain auth is not supported by default


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org


Morten

On Thu, Jun 12, 2014 at 10:22 AM, Md. Monjur Rahman monjur@icddrb.org wrote:

Dear All,

I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.

I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {

        $("#link1").click(function () {

            $.post("[http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true](http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true)", { j_username: "admin", j_password: "district" });





            window.open("[http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action](http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action)");





        });

    });

please help.

Md Monjur Rahman

Senior Computer Programmer,

Center for Equity & Health System,

icdd,b, Mohakhali, Dhaka, Bangladesh.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Ok, so one should probably delegate one server to be the “proxy” server, and this one will have different endpoint to the differents servers, and these will all be authenticating using the Authorization header.

(Are you still with John? he has a nginx setup for something similar)

···


Morten

On Thu, Jun 12, 2014 at 11:53 AM, Knut Staring knutst@gmail.com wrote:

I think the point is that it is not the same server (it is several different servers)

On 12 Jun 2014 15:38, “Knut Staring” knutst@gmail.com wrote:

Thanks Morten,
Is this the right section in the manual?

http://www.dhis2.org/doc/snapshot/en/implementer/html/ch08s03.html

Knut

On Thu, Jun 12, 2014 at 10:38 AM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

i test this on our demo server (http://apps.dhis2.org/dev) and this works fine:

$.post(’/dev/dhis-web-commons-security/login.action?authOnly=true’, { j_username: “admin”, j_password: “district” })

Is the request coming from the same server? remember that x-domain auth is not supported by default


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

http://dhis2.org


Morten

On Thu, Jun 12, 2014 at 10:22 AM, Md. Monjur Rahman monjur@icddrb.org wrote:

Dear All,

I have several DHIS application from different server. I have developed a page which contains all the credential information about those applications.

I want the DHIS application logged on after clicking the link. But it always redirect me to login page of DHIS. My code snippet is:

$(document).ready(function () {

        $("#link1").click(function () {

            $.post("[http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true](http://localhost:8191/dhis215/dhis-web-commons-security/login.action?authOnly=true)", { j_username: "admin", j_password: "district" });







            window.open("[http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action](http://localhost:8191/dhis215/dhis-web-dashboard-integration/index.action)");







        });

    });

please help.

Md Monjur Rahman

Senior Computer Programmer,

Center for Equity & Health System,

icdd,b, Mohakhali, Dhaka, Bangladesh.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp