line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::Authentication::Store::Session; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
124
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
192
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
17
|
use base qw(CGI::Application::Plugin::Authentication::Store); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2696
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
CGI::Application::Plugin::Authentication::Store::Session - Session based Store |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This document describes CGI::Application::Plugin::Authenticatio::Store::Session version 0.20 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use base qw(CGI::Application); |
20
|
|
|
|
|
|
|
use CGI::Application::Plugin::Session; |
21
|
|
|
|
|
|
|
use CGI::Application::Plugin::Authentication; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__PACKAGE__->authen->config( |
24
|
|
|
|
|
|
|
STORE => 'Session', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This module uses a session to store authentication information across multiple requests. |
30
|
|
|
|
|
|
|
It depends on the L plugin being present. Actually, |
31
|
|
|
|
|
|
|
it only requires that there be a 'session' method in the CGI::Application module that |
32
|
|
|
|
|
|
|
will return a valid CGI::Session object. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 fetch |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This method accepts a list of parameters and fetches them from the session. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub fetch { |
43
|
24
|
|
|
24
|
1
|
44
|
my $self = shift; |
44
|
24
|
|
|
|
|
48
|
my @params = @_; |
45
|
24
|
|
|
|
|
38
|
my @items; |
46
|
24
|
|
|
|
|
47
|
foreach my $param (@params) { |
47
|
24
|
|
|
|
|
95
|
my $key = &_names_to_keys($param); |
48
|
24
|
|
|
|
|
68
|
push @items, $self->_session->param($key); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
23
|
|
|
|
|
267421
|
return @items[0..$#items]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 save |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This method accepts a hash of parameters and values and saves them into the session. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub save { |
61
|
4
|
|
|
4
|
1
|
7
|
my $self = shift; |
62
|
4
|
|
|
|
|
22
|
my %items = @_; |
63
|
4
|
|
|
|
|
15
|
my $session = $self->_session; |
64
|
4
|
|
|
|
|
43
|
while (my ($param, $value) = each %items) { |
65
|
10
|
|
|
|
|
253
|
my $key = _names_to_keys($param); |
66
|
10
|
|
|
|
|
36
|
$session->param( $key => $value ); |
67
|
|
|
|
|
|
|
} |
68
|
4
|
|
|
|
|
145
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 delete |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This method accepts a list of parameters and deletes them from the session. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub delete { |
78
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
79
|
0
|
|
|
|
|
0
|
my @items = &_names_to_keys(@_); |
80
|
0
|
|
|
|
|
0
|
$self->_session->clear(\@items); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# |
84
|
|
|
|
|
|
|
# Return the session object |
85
|
|
|
|
|
|
|
# |
86
|
|
|
|
|
|
|
sub _session { |
87
|
28
|
|
|
28
|
|
137
|
return $_[0]->authen->_cgiapp->session; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
# We want all parameters in the session to have a common prefix |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
sub _names_to_keys { |
94
|
34
|
|
|
34
|
|
55
|
my @names = @_; |
95
|
34
|
|
|
|
|
94
|
my @keys = map { 'AUTH_'.uc($_) } @names; |
|
34
|
|
|
|
|
130
|
|
96
|
34
|
|
|
|
|
116
|
return @keys[0..$#keys]; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L, L, perl(1) |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Cees Hek |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Copyright (c) 2005, SiteSuite. All rights reserved. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |