Seumas, I wrote a script a while ago using LDAP for logins, and ran into a similar problem. What I ended up doing was to put a "expired" or "~logged-in" variable if you want to follow
CGI::Session::Cookbook. The code is below, but what you need to do with this implementation is fetch the session, and check for the existance of that session variable, because when the expiration is triggered it disappears. This helps with inactivity expirations, because every time you go to the session on the server, you can just touch that session variable.
if( $authority = verify_password(\@autharray)){
# ldap authentication succeeded at this point
# set session variables and other expiry information
my $session = new CGI::Session( "driver:MySQL", undef, {Handle
+ => $dbh})
;
my $sid = $session->id;
syslog( 'notice', "sid: %s", $sid);
$session->param("~logged-in",1);
$session->param("username",$autharray[0]);
$session->param("org-name",$autharray[2]);
$session->expires("~logged-in", "+15m");
syslog( 'notice',"after session writing") if $debug;
# write cookie information to user browser
my $cookie = $cgi->cookie(CGISESSID =>$session->id);
print $cgi->header(-cookie=>$cookie);
# ...
# other proprietary stuff
}
I hope this helps.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.