Topic
  • 1 reply
  • Latest Post - ‏2011-06-03T14:03:17Z by SystemAdmin
SystemAdmin
SystemAdmin
9224 Posts

Pinned topic PHP superglobal $_SERVER to get authenticated user

‏2011-04-29T16:24:08Z |
NOTE: this thread was migrated from projectzero.org. Some content and formatting may have been lost in the move.


Originally posted by projectzero userid: andrewarentsen - f=4&t=2306#p9365
I'm using the CICSTS 4.1 Dynamic Scripting Feature Pack to run the projectzero code and developing a PHP based site. I have configured an application to use HTTP Basic Authentication over a HTTPS connection. Normally I would be able to get the username of the person who signed in by using the $_SERVER superglobal but I have found that this is not supported. Does anyone else know of a way to retrieve the authenticated username from a PHP script in this scenario?
Thanks,
Andrew
Updated on 2011-06-03T14:03:17Z at 2011-06-03T14:03:17Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: PHP superglobal $_SERVER to get authenticated user

    ‏2011-06-03T14:03:17Z  

    Originally posted by projectzero userid: andrewarentsen - f=4&t=2306#p9404
    I've found a way to do this:

    <?php                                        <br />
    //Get the authenticated user <br />
    function get_authUser()                      <br />
    {                                            <br />
      java_import("com.ibm.cics.server.Task");   <br />
      $myTask = Task::getTask();                 <br />
      $userid = $myTask->getUSERID();            <br />
      return strtoupper(trim($userid));          <br />
    }                                            <br />
    ?>
    
    Updated on 2014-03-25T05:44:44Z at 2014-03-25T05:44:44Z by iron-man