[rt-users] Use of cookies for external authentication

ParimalaRamdas at oaktech.com ParimalaRamdas at oaktech.com
Wed Jun 18 08:37:56 EDT 2003


Hi all,
  After collecting data from many resources, I have managed to 
authenticate RT ver 2.1.88 by use of cookies. I am posting the changes 
done to the scripts in the hope that someone might find it useful.

-Have set cookies in my website for the current user logged in
     setcookie("user", value); //in php

-In file RT_SiteConfig.pm
    Set($WebExternalAuth, 1);
    Set($WebExternalAuto, 1);

-In file InstallDir/share/html/autohandler
    //add the 2 lines at the beginning of the file
    use CGI qw(standard);
    use CGI::Cookie;

   //modify the line for external authentication by removing 
($ENV{'REMOTE_USER'}) so it reads
   elseif ($RT::WebExternalAuth) {

   //comment the foll line
   $user = $ENV{'REMOTE_USER'};
   // and add these immediately below
   my $hashref = fetch CGI::Cookie;
   my %hashval = %$hashref;
   my $name = $hashval{'user'}->value;
   $user = $name;

   //comment the foll
   if ($^O !~ /^(?:riscos|MacOS|MSWin32|dos|os2)$/) {
        #Populate fields with information from Unix /etc/passwd
        my ($comments, $realname) = (getpwnam($user))[5, 6];
        $UserObj->SetComments($comments) if defined $comments;
        $UserObj->SetRealName($realname) if defined $realname;
   }
   elsif ($^O eq 'MSWin32' and eval 'use Net::AdminMisc; 1') {
        # Populate fields with information from NT domain controller
   }

And RT is ready to accept the username passed by the cookie and creats a 
user in the db if it doesn't already exist or display the home page if 
user exists. Works like a charm.
Thanks,
Parimala.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20030618/c801442d/attachment.htm>


More information about the rt-users mailing list