MemsessionCAS.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 49 CC 4 SCAR 26.4
CC
4
Cov
0%
get
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.0
1 package Lemonldap::Handlers::MemsessionCAS;
2 use strict;
3 use Apache::Session::Memorycached;
4 our ( @ISA, $VERSION, @EXPORTS );
5 $VERSION = '3.1.0';
6 our $VERSION_LEMONLDAP = "3.1.0";
7 our $VERSION_INTERNAL = "3.1.0";
8  
9 sub get {
10 my $class = shift;
11 my %_param = @_;
12  
13 my $id = $_param{'id'};
14 return 0 unless $id;
15 my $config = $_param{'config'};
16  
17 my $SERVERS = $config->{SERVERS};
18 $SERVERS->{timeout} = '30';
19 my %session;
20 my %_principal;
21 my %__principal;
22 my %_session;
23 tie %session, 'Apache::Session::Memorycached', $id, $SERVERS;
24 if ( !$session{service} )
25 { ## the cookie is present but i can't retrieve session
26 ## three causes : Too many connection are served.
27 ## the server of session was restarted
28 ## It's time out
29 untie %session;
30  
31 # I say it's time out
32  
33 }
34 else {
35 if ( $session{USED} eq 'TRUE' ) {
36 $session{VALID} = 'FALSE';
37  
38 }
39 else {
40 $session{VALID} = 'TRUE';
41  
42 }
43 $session{USED} = 'TRUE';
44 %_session = %session;
45 untie %session;
46 delete $SERVERS->{timeout};
47 tie %_principal, 'Apache::Session::Memorycached', $_session{principal},
48 $SERVERS;
49 %__principal = %_principal;
50 untie %_principal;
51  
52 }
53 my $self = \%_session;
54 bless $self, $class;
55 my $self2 = \%__principal;
56 bless $self2, $class;
57  
58 return ( $self, $self2 );
59 }
60 1;
61  
62 =pod
63  
64 =for html <center> <H1> Lemonldap::Handlers::Memsession </H1></center>
65  
66  
67 =head1 NAME
68  
69 Lemonldap::Handlers::Memsession - Plugin for Lemonldap sso system
70  
71 =head1 DESCRIPTION
72  
73 Memsession is the default session backend manager of lemonldap websso framework .
74 This module uses memcached in order to store information.
75
76 see http://lemonldap.sf.net for more infos .
77  
78 =head2 Overlay
79  
80 If you wat use your own session backend method you must use SESSIONSTOREPLUGIN parameter like this :
81 in httpd.conf : perlsetvar lemonldappluginbackend MyModule
82  
83 Your module must accept 2 parameters : config (all the hash of config ) and id (collect in the cookie )
84 Your module must provide the 'get' method and return a reference on hash of session.
85  
86 =head1 SEE ALSO
87  
88 Lemonldap(3), Lemonldap::Portal::Standard
89  
90 http://lemonldap.sourceforge.net/
91  
92 "Writing Apache Modules with Perl and C" by Lincoln Stein E<amp> Doug
93 MacEachern - O'REILLY
94  
95 =over 1
96  
97 =item Eric German, E<lt>germanlinux@yahoo.frE<gt>
98  
99 =item Xavier Guimard, E<lt>x.guimard@free.frE<gt>
100  
101 =item Isabelle Serre, E<lt>isabelle.serre@justice.gouv.frE<gt>
102  
103 =back
104  
105 =head1 COPYRIGHT AND LICENSE
106  
107 Copyright (C) 2004 by Eric German E<amp> Xavier Guimard E<amp> Isabelle Serre
108  
109 Lemonldap originaly written by Eric german who decided to publish him in 2003
110 under the terms of the GNU General Public License version 2.
111  
112 =over 1
113  
114 =item This package is under the GNU General Public License, Version 2.
115  
116 =item The primary copyright holder is Eric German.
117  
118 =item Portions are copyrighted under the same license as Perl itself.
119  
120 =item Portions are copyrighted by Doug MacEachern and Lincoln Stein.
121 This library is under the GNU General Public License, Version 2.
122  
123 =item Portage under Apache2 is made with help of : Ali Pouya and
124 Shervin Ahmadi (MINEFI/DGI)
125  
126 =back
127  
128 This program is free software; you can redistribute it and/or modify
129 it under the terms of the GNU General Public License as published by
130 the Free Software Foundation; version 2 dated June, 1991.
131  
132 This program is distributed in the hope that it will be useful,
133 but WITHOUT ANY WARRANTY; without even the implied warranty of
134 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
135 GNU General Public License for more details.
136  
137 A copy of the GNU General Public License is available in the source tree;
138 if not, write to the Free Software Foundation, Inc.,
139 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
140  
141 =cut
142