[Catalyst] Extending session expiry time?

Paolo Gianrossi paolino.gianrossi at gmail.com
Thu Feb 16 19:42:09 GMT 2012


Hi Jesse,
 what I do is (blatantly taken from CatalystX::SimpleLogin source)
something like

 # in Login controller, and action login

 my $parms =3D $c->request->body_parameters;

 if ($c->authenticate({ username =3D> $parms->{username},
                                   password =3D> $parms->{password}} )) {
             $c->extend_session_expires(999999999999) if
$c->request->address =3D~ m/^192\.168/g; #or whatever way to determine local
network...
             $c->response->redirect($c->uri_for_action('whatever/action'));
  }
  #....


  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
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120216/4278d=
47f/attachment.htm


More information about the Catalyst mailing list