HTTP basic access authentication with Image charts and Active directory

(9 posts) (2 voices)

Tags:

No tags yet.

  1. bushraj, Member

    Hey ,

    I want to use http authentication for image charts .. For that i have referred the documentation and created a php file as follows:

    <?php

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://tracker5/mydbr/report.php?r=39&m=1&h=8ca399a0212071c71840ff61b183e8e8e62243ba&i=1&hdr=0');

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

    curl_setopt($ch, CURLOPT_USERPWD, 'dba:dba');

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-MYDBR-AUTH: 1'));

    $data = curl_exec($ch);

    curl_close($ch);

    echo $data;

    ?>

    Separately the report is showing charts but when i run this curl script it displays nothing .. However , curl 7.24.0 is enabled. Whats the issue?

    Secondly, i want to use this script for Active Directory. So how can i use HTTP basic Authentication for Active Directory .. Instead of 'dba'as username , it should check Active Directory logged in user..

    Kindly help.

  2. myDBR Team, Key Master

    myDBR's HTTP basic Authentication uses the authentication method that is set in myDBR server.

    Do you have Active Directory authentication enabled in the server? If you do, you should use AD username/password.

    Secondly, please notice that the report run as is is producing an HTML page. If you only want the image, just request the image.

    --
    myDBR Team

  3. bushraj, Member

    Yes AD is enable in myDBR server .. but how to use the AD username in this php file as every user logs in with there different username ... I can not use a single username and password here .

    It is also not showing the html page /report .. shows nothing

  4. bushraj, Member

    The script only shows the report name not the charts

  5. myDBR Team, Key Master

    If you want user's credentials to be passed in the script the user has to give the credentals as myDBR does not know user's password. It only knows if the password is correct or not.

    If you use cURL to fetch images, use &embed_image=1 in URL if you are not using embedded images by default.

    --
    myDBR Team

  6. bushraj, Member

    When I run the Curl script after adding embed_image in the URL, It still doesn't show the chart( It only shows the heading). Then I have accessed the report from direct URL .It is showing the chart .And I ran the script after it .It shows the image chart .. Why it is not showing when running the script for the very first time before directly accessing the report.

    Yes I ll be using user credentials in curl script but i want to use it for AD users {like the user who logged in (stored in a variable)not using the script with static users} .How to do it? I have already connected myDBR with its AD settings.

    Thanks really appreciate your support.

  7. myDBR Team, Key Master

    When I run the Curl script after adding embed_image in the URL, It still doesn't show the chart( It only shows the heading). Then I have accessed the report from direct URL .It is showing the chart .And I ran the script after it .It shows the image chart .. Why it is not showing when running the script for the very first time before directly accessing the report.

    What is the URL you are using? Make sure you use embedded images.

    Yes I ll be using user credentials in curl script but i want to use it for AD users {like the user who logged in (stored in a variable)not using the script with static users} .How to do it? I have already connected myDBR with its AD settings.

    Please note that when you make your own script that uses cURL and HTTP basic authentication to fetch data, it has nothing to do with the user logged into myDBR. It uses separate login which you define in the script.

    --
    myDBR Team

  8. bushraj, Member

    Following is my Curl script :

    <?php

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, 'http://tracker5/mydbr/report.php?r=38&m=1&h=315a2464b5281dd49a133ae83f0640b0cbc66ed8&i=1&embed_image=1');

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

    curl_setopt($ch, CURLOPT_USERPWD, 'abc:abc');

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-MYDBR-AUTH: 1'));

    $data = curl_exec($ch);

    curl_close($ch);

    echo $data;

    ?>

    And how can I define dynamic login in my script not static like abc:abc

  9. myDBR Team, Key Master

    The script looks ok provided that the username and the password are correct. Make sure you are using myDBR's latest version as the old ones did not have the embed_image-parameter.

    As for passing username and password per user to your script, you need to ask user the username and the password as the user is the only one knowing his/her password.

    --
    myDBR Team


Reply

You must log in to post.