Hello,
I have a Mod Perl authentication handler and it needs to retrieve the
session id from a cookie. It is unable to retrieve any cookies and I get
the following error. It does not even print any of the cookies. I would
appreciate any help with this.
Can't call method "value" on an undefined value at
/usr/bin/perl/lib/site_perl/5.005/CAS/SSO.pm line 30.
Below is the code and the related httpd.conf entry
=======================================
<Location /forms>
AuthName realm
AuthType Basic
PerlAuthenHandler CAS::SSO
Require valid-user
</Location>
=======================================
package CAS::SSO;
use strict;
use Apache::Constants qw(OK DONE REDIRECT DECLINED);
use Apache::Log();
use Socket;
use CGI;
use CGI::Cookie;
use IO::Socket;
$CAS::SSO::VERSION = "1.00";
sub handler {
my $r = shift;
my ( $log ) = $r->log;
$log->error("1. Inside Handler.");
my $invalidVal = 'INVALID';
my $uri = $r->uri;
$log->error("2. Requested URI ==> $uri");
my %cookies = CGI::Cookie->fetch($r);
foreach (keys %cookies){
$log->error("Cookie: $cookies{$_}");
}
my $token = $cookies{'SessionID'}->value;
chomp($token);
$log->error("3. Session ID ==> $token");
return OK;
}