1Plack::Session::State(3Upsme)r Contributed Perl DocumentaPtliaocnk::Session::State(3pm)
2
3
4

NAME

6       Plack::Session::State - Basic parameter-based session state
7

SYNOPSIS

9         use Plack::Builder;
10         use Plack::Middleware::Session;
11         use Plack::Session::State;
12
13         my $app = sub {
14             return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
15         };
16
17         builder {
18             enable 'Session',
19                 state => Plack::Session::State->new;
20             $app;
21         };
22

DESCRIPTION

24       This will maintain session state by passing the session through the
25       request params. It does not do this automatically though, you are
26       responsible for passing the session param.
27
28       This should be considered the state "base" class (although subclassing
29       is not a requirement) and defines the spec for all
30       Plack::Session::State::* modules. You will only need to override a
31       couple methods if you do subclass. See Plack::Session::State::Cookie
32       for an example of this.
33
34       WARNING: parameter based session ID management makes session fixation
35       really easy, and that makes your website vulnerable. You should really
36       avoid using this state in the production environment except when you
37       have to deal with legacy HTTP clients that do not support cookies.
38
39       In the future this parameter based state handling will be removed from
40       this base class and will be moved to its own State class.
41

METHODS

43       new ( %params )
44           The %params can include session_key, sid_generator and sid_checker
45           however in both cases a default will be provided for you.
46
47       session_key
48           This is the name of the session key, it defaults to
49           'plack_session'.
50
51       sid_generator
52           This is a CODE ref used to generate unique session ids, by default
53           it will generate a SHA1 using fairly sufficient entropy. If you are
54           concerned or interested, just read the source.
55
56       sid_validator
57           This is a regex used to validate requested session id.
58
59   Session ID Managment
60       get_session_id ( $env )
61           This is the method used to extract the session id from a $env.
62           Subclasses will often only need to override this method and the
63           "finalize" method.
64
65       validate_session_id ( $session_id )
66           This will use the "sid_validator" regex and confirm that the
67           $session_id is valid.
68
69       extract ( $env )
70           This will attempt to extract the session from a $env by looking for
71           the "session_key" in the request params. It will then check to see
72           if the session is valid and that it has not expired. It will return
73           the session id if everything is good or undef otherwise.
74
75       generate ( $request )
76           This will generate a new session id using the "sid_generator"
77           callback.  The $request argument is not used by this method but is
78           there for use by subclasses. The $request is expected to be a
79           Plack::Request instance or an object with an equivalent interface.
80
81       finalize ( $session_id, $response )
82           Given a $session_id and a $response this will perform any
83           finalization necessary to preserve state. This method is called by
84           the Plack::Session "finalize" method. The $response is expected to
85           be a Plack::Response instance or an object with an equivalent
86           interface.
87
88   Session Expiration Handling
89       expire_session_id ( $id, $response )
90           This will mark the session for $id as expired. This method is
91           called by the Plack::Session "expire" method.
92

BUGS

94       All complex software has bugs lurking in it, and this module is no
95       exception. If you find a bug please either email me, or add the bug to
96       cpan-RT.
97

AUTHOR

99       Stevan Little <stevan.little@iinteractive.com>
100
102       Copyright 2009, 2010 Infinity Interactive, Inc.
103
104       <http://www.iinteractive.com>
105
106       This library is free software; you can redistribute it and/or modify it
107       under the same terms as Perl itself.
108
109
110
111perl v5.32.1                      2021-01-27        Plack::Session::State(3pm)
Impressum