lemonldap-ng/modules/lemonldap-ng-handler/example/autoProtectedCGI.pl
Xavier Guimard e502a3dc57 LEMONLDAP::NG::Handler :
* new feature: Lemonldap::NG::Handler::CGI can be used directly in Perl CGI instead of using a real handler
 * little bugs correction
2007-04-14 13:12:11 +00:00

31 lines
714 B
Perl

#!/usr/bin/perl
my $cgi = new Lemonldap::NG::Handler::CGI ( {
localStorage => "Cache::FileCache",
localStorageOptions => {
'namespace' => 'MyNamespace',
'default_expires_in' => 600,
},
configStorage => {
type => 'File',
dirName => '__DIR__/conf',
},
https => 0,
}
);
$cgi->authenticate();
print $cgi->header;
unless( $cgi->authorize ) {
print $cgi->start_html ('Forbidden');
print "You're not authorized to see this page";
print $cgi->end_html;
}
else {
print $cgi->start_html ('Authorized');
print "<h1>Welcome</h1>You're authorized to see this page";
print $cgi->end_html;
}