[Catalyst] Extending session expiry time?

Jesse Sheidlower jester at panix.com
Fri Feb 17 10:54:15 GMT 2012


On Thu, Feb 16, 2012 at 08:42:09PM +0100, Paolo Gianrossi wrote:
> Hi Jesse,
>  what I do is (blatantly taken from CatalystX::SimpleLogin source)
> something like
> 
>  # in Login controller, and action login
> 
>  my $parms = $c->request->body_parameters;
> 
>  if ($c->authenticate({ username => $parms->{username},
>                                    password => $parms->{password}} )) {
>              $c->extend_session_expires(999999999999) if
> $c->request->address =~ m/^192\.168/g; #or whatever way to determine local
> network...
>              $c->response->redirect($c->uri_for_action('whatever/action'));
>   }
>   #....

I'm afraid that this did not work. I did test to make sure the IP
address was being correctly matched, so I know that the
$c->extend_session_expires(999999999999) was executed. But the affected
users still had to log in after an hour of non-use.

Any other session experts have a thought?

Jesse Sheidlower

> 
>   HTH!
> 
> cheers
> paolino
> 
> --
> Paolo Gianrossi
> 
> (An unmatched left parenthesis
>  creates an unresolved tension
>  that will stay with you all day
>                                    -- xkcd
> 
> 
> 
> 2012/2/16 Jesse Sheidlower <jester at panix.com>
> 
> >
> > Using Catalyst::Plugin::Session, is there any way to extend a session
> > _longer_ than the expiry time I give in my conf file? The docs for
> > session_expire_key say it's only useful if _shorter_ than the default
> > expiry time.
> >
> > The situation I'm trying to solve is basically that I have an app with
> > local and external users, and I'd like to make it so that users on the
> > internal network have permanent cookies, and thus don't have to re-login
> > all the time, but outside users have their sessions expire in an hour.
> >
> > I suppose I could just set an infinite expiration in my conf file, and
> > then use session_expire_key to shorten the sessions for external users,
> > but that seems like the reverse of what I really want, which is to give
> > more rights to one group, not to give less rights to another.
> >
> > Jesse Sheidlower



More information about the Catalyst mailing list