Nobase64.pm untested

filter: Statementstmt 0.0% 0 / 51 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 73 CC 6 SCAR 25.9
CC
6
Cov
0%
get
20.0
forge
12.0
BEGIN
2.0
CRAP 13.3
1 package Lemonldap::Handlers::Nobase64;
2 use strict;
3 use MIME::Base64;
4 our ( @ISA, $VERSION, @EXPORTS );
5 $VERSION = '2.00';
6 our $VERSION_LEMONLDAP = "2.0";
7 our $VERSION_INTERNAL = "2.0";
8  
9 sub get {
10 my $class = shift;
11 my %_param = @_;
12 my $profil = $_param{profil};
13 my $dn = $_param{dn};
14 my $header = $_param{config}->{SENDHEADER} || 'Authorization';
15 my $self;
16 my $ligne_h;
17 if ( $profil eq '_ALLOW_' ) { $profil = ""; }
18  
19 if ( $profil =~ /^uid/ ) {
20 $ligne_h = $profil;
21 }
22 else {
23 $ligne_h = $dn;
24 my ($user) = $ligne_h =~ /uid=(.+?),/;
25 $ligne_h=$user;
26 if ( defined($profil) ) {
27 $ligne_h .= ":$profil";
28 }
29 }
30 $self->{decoded} = "$ligne_h";
31 $self->{clair} = "Basic $ligne_h";
32 bless $self, $class;
33 return $self;
34 }
35  
36 sub forge {
37 my $class = shift;
38 my %_param = @_;
39 my $line = $_param{line};
40 my $self;
41 $self->{decoded} = $line;
42 my ($user) = $line =~ /(uid.+?),/;
43 $self->{user} = $user;
44 my $header = $_param{config}->{SENDHEADER} || 'Authorization';
45 return 0 if ( $header eq 'NONE' );
46  
47  
48 ( my $b, my $e ) = $line =~ /(.+)%b64%(.+)%b64%/;
49 if ($e) {
50 # $e = encode_base64( $e, '' );
51 $line =~ s/%b64%.+%b64%/$e/;
52 }
53 else {
54  
55 # for previous version
56 ( my $b, my $e ) = $line =~ /(.+?)\s(.+)/;
57 $e = encode_base64( $e, '' );
58 $line =~ s/ (.+)$/ $e/;
59 }
60  
61 $self->{content} = $line;
62 $self->{header} = $header;
63 bless $self, $class;
64 return $self;
65 }
66 1;
67  
68 =pod
69  
70 =for html <center> <H1> Lemonldap::Handlers::AuthorizationHeader </H1></center>
71  
72  
73 =head1 NAME
74  
75 Lemonldap::Handlers::AuthorizationHeader - Plugin for Lemonldap sso system
76  
77 =head1 DESCRIPTION
78  
79 AuthorizationHeader is the default header builder manager of lemonldap websso framework .
80  
81
82 see http://lemonldap.sf.net for more infos .
83  
84 =head2 Overlay
85  
86 If you want use your own header method you must use PLUGINHEADER parameter like this :
87 in httpd.conf : perlsetvar lemonldappluginheader MyModule
88  
89 Your module must accept 3 parameters : config (all the hash of config ) , dn and sting of role (profil) .
90  
91 Your module must provide the 'get' and 'forge' methods .
92
93 Those methods work with SENDHEADER parameter which tells what will be the header (NONE value for no header)
94  
95 =head1 SEE ALSO
96  
97 Lemonldap(3), Lemonldap::Portal::Standard
98  
99 http://lemonldap.sourceforge.net/
100  
101 "Writing Apache Modules with Perl and C" by Lincoln Stein E<amp> Doug
102 MacEachern - O'REILLY
103  
104 =over 1
105  
106 =item Eric German, E<lt>germanlinux@yahoo.frE<gt>
107  
108 =item Isabelle Serre, E<lt>isabelle.serre@justice.gouv.frE<gt>
109  
110 =back
111  
112 =head1 COPYRIGHT AND LICENSE
113  
114 Copyright (C) 2004 by Eric German E<amp> Isabelle Serre
115  
116 Lemonldap originaly written by Eric german who decided to publish him in 2003
117 under the terms of the GNU General Public License version 2.
118  
119 =over 1
120  
121 =item This package is under the GNU General Public License, Version 2.
122  
123 =item The primary copyright holder is Eric German.
124  
125 =item Portions are copyrighted under the same license as Perl itself.
126  
127 =item Portions are copyrighted by Doug MacEachern and Lincoln Stein.
128 This library is under the GNU General Public License, Version 2.
129  
130 =item Portage under Apache2 is made with help of : Ali Pouya and
131 Shervin Ahmadi (MINEFI/DGI)
132  
133 =back
134  
135 This program is free software; you can redistribute it and/or modify
136 it under the terms of the GNU General Public License as published by
137 the Free Software Foundation; version 2 dated June, 1991.
138  
139 This program is distributed in the hope that it will be useful,
140 but WITHOUT ANY WARRANTY; without even the implied warranty of
141 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142 GNU General Public License for more details.
143  
144 A copy of the GNU General Public License is available in the source tree;
145 if not, write to the Free Software Foundation, Inc.,
146 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
147  
148 =cut
149