Generic.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod n/a totaltotal 0.0% 0 / 52 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Lemonldap::Handlers::Generic;
2 use strict;
3 use warnings;
4 ##### use ######
5 use Apache2::URI();
6 use Apache::Constants qw(:common :response);
7 use MIME::Base64;
8 use LWP::UserAgent;
9 use Lemonldap::Config::Parameters;
10 use Lemonldap::Config::Initparam;
11 use Lemonldap::Handlers::Utilities;
12 use Lemonldap::Handlers::Core;
13 use Apache2::Log();
14 use Apache2::ServerRec ();
15  
16 #### common declaration #######
17 our ( @ISA, $VERSION, @EXPORTS );
18 $VERSION = '3.0.0';
19 our $VERSION_LEMONLDAP = "3.0.0";
20 our $VERSION_INTERNAL = "3.0.0";
21  
22 ####
23 ####
24 ##############################
25  
26 =pod
27  
28 =for html <center> <H1> Lemonldap::Handlers::Generic4a2 </H1></center>
29  
30  
31 =head1 NAME
32  
33 Lemonldap::Handlers::Generic - Perl extension for Lemonldap sso system
34  
35 Lemonldap::Handlers::Generic4a2 - Handler for Apache2 Lemonldap SSO
36 system
37  
38  
39 =head1 SYNOPSIS
40
41 In httpd.conf
42  
43 .....
44 perltranshandler Lemonldap::Handlers::Generic4a2
45 .....
46
47  
48 =head1 DESCRIPTION
49  
50 Generic4a2 is the central piece of websso framework .
51 This module provides several methods but the principal goal of this is the handler function .
52 It can be combined with mod_proxy or mod_rewrite and all other apache's modules .
53 It provides also an built-in http proxy with LWP .
54 see http://lemonldap.sf.net for more infos .
55
56  
57 =head2 Parameters (see also doc folder)
58  
59 A minimal configuration must provide infos about :
60  
61 =over 1
62  
63 =item config
64  
65 PerlSetVar ConfigFile /usr/local/apache/conf/config_demo1.xml
66  
67 The filename of the mean XML Config :It's REQUIRED
68  
69 =item domain
70
71 PerlSetVar Domain demo.net
72
73 It fixes the value of domain for the application protected by this handler (see below)
74  
75 =item xml section in config
76
77 Perlsetvar HandlerID <xml section>
78  
79 It fixes the value of XML section in config
80  
81 =back
82  
83  
84 =head2 Example (a KISS example, see also eg folder)
85
86 In httpd.conf
87  
88 <virtualHost 127.0.0.1:80>
89 servername authen.demo.net
90 PerlModule Apache2::compat
91 PerlModule Bundle::Apache2
92 PerlModule Lemonldap::Handlers::Generic4a2
93 perltranshandler Lemonldap::Handlers::Generic4a2
94 PerlSetVar Domain demo.net
95 PerlSetVar Configfile /usr/local/apache/conf/application_new.xml
96 PerlSetVar HandlerID myintranet
97 proxypass /intranet http://lemonldap.sourceforge.net
98 proxypassreverse /intranet http://lemonldap.sourceforge.net
99 documentroot /usr/local/apache/htdocs
100 </virtualhost>
101  
102  
103 In /usr/local/apache/conf/application_new.xml
104 <lemonconfig>
105 <domain id="demo.net"
106 Cookie="lemondemo"
107 >
108 <handler
109 id="myintranet"
110 DisableAccessControl= "1"
111 />
112 </domain>
113 </lemonconfig>
114  
115
116 Now you can put http://authen.demo.net/intranet/ in your browser and you will see lemonldap's site
117 AND now you can control who and where goes on your site .
118
119 You can pass parameters from httpd.conf with perlsetvar facilities or put them in xml file
120  
121 =head2 Functions
122  
123 =over 1
124  
125 =item handler
126  
127 It's the mean function which does all jobs . If the enebledproxy parameter is set to 1 ,this function
128 will push proxy_handler function reference on the handler's stack . If not it returns DECLINED (mod_proxy will be actived)
129  
130 =item proxy_handler
131  
132 It's the built-in proxy (LWP) web embedded in lemonldap framework . It is actived by enabledproxy parameter .
133 Some parameters are about this proxy and its behaviour
134  
135 =item _lemonldap_debug
136  
137 append this keyword at the end of url and you will can see all headers send to host.
138 Available ONLY with built-in proxy
139  
140  
141 =back
142  
143  
144 =head2 Features
145  
146 Generic4a2 is build arround perl's modules .
147  
148 Those modules are :
149  
150 =over 1
151  
152 =item Utilities :
153  
154 collection of functions
155  
156 =item Core :
157
158 It provides basics services like the cache service, forge header service or authorization service.
159
160 Core.pm can use YOUR own services for all this cycle . It's plugger . Lemonldap framework is available
161 with somes services but you can with Core.pm propose your own schemas.
162 News parameters were added in XML DTD in order to describe the sequence.
163  
164 =item MatrixPolicy :
165
166 manage authorization process , based on the hash of session (like preceding version)
167  
168 =item Memsession :
169
170 manage the backend of session (cache level 3 and 4 )
171  
172 =item AuthorizationHeader :
173
174 manage the construction of header
175  
176 =item RewriteHTML :
177  
178 Rewrite on fly html source in order to ajust somes tags like BASE , href or src
179 Available ONLY with built-in proxy
180
181  
182 =back
183  
184 =head4 More features
185  
186 =over 1
187  
188 =item Authentification
189
190 Keep in mind that the handler doesn't know HOW authenticate anybody but only knows WHERE authenticate .
191 The parameter 'portal' tells it where to send the authentification request.
192  
193 =item Caches
194  
195 Thre are three levels of cache in lemonldap .
196  
197 *First cache (level 1) is a very KISS , it's a memory structure in the program .
198 *Next cache (level 2) is realised by using berkeleyDB hash
199 *Last cache (level 3) is realised by using memcached (see Apache::Session::Memorycached on CPAN)
200  
201 =back
202  
203 =head1 SEE ALSO
204  
205 Lemonldap(3), Lemonldap::Portal::Standard
206  
207 http://lemonldap.sourceforge.net/
208  
209 "Writing Apache Modules with Perl and C" by Lincoln Stein E<amp> Doug
210 MacEachern - O'REILLY
211  
212 =over 1
213  
214 =item Eric German, E<lt>germanlinux@yahoo.frE<gt>
215  
216 =item Isabelle Serre, E<lt>isabelle.serre@justice.gouv.frE<gt>
217  
218 =back
219  
220 =head1 COPYRIGHT AND LICENSE
221  
222 Copyright (C) 2004 by Eric German E<amp> Isabelle Serre
223  
224 Lemonldap originaly written by Eric german who decided to publish him in 2003
225 under the terms of the GNU General Public License version 2.
226  
227 =over 1
228  
229 =item This package is under the GNU General Public License, Version 2.
230  
231 =item The primary copyright holder is Eric German.
232  
233 =item Portions are copyrighted under the same license as Perl itself.
234  
235 =item Portions are copyrighted by Doug MacEachern and Lincoln Stein.
236 This library is under the GNU General Public License, Version 2.
237  
238 =item Portage under Apache2 is made with help of : Ali Pouya and
239 Shervin Ahmadi (MINEFI/DGI)
240  
241 =back
242  
243 This program is free software; you can redistribute it and/or modify
244 it under the terms of the GNU General Public License as published by
245 the Free Software Foundation; version 2 dated June, 1991.
246  
247 This program is distributed in the hope that it will be useful,
248 but WITHOUT ANY WARRANTY; without even the implied warranty of
249 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
250 GNU General Public License for more details.
251  
252 A copy of the GNU General Public License is available in the source tree;
253 if not, write to the Free Software Foundation, Inc.,
254 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
255  
256  
257 =cut
258