* Doxygen doc update

* More tests
* perltidy on tests
This commit is contained in:
Xavier Guimard 2009-02-25 18:10:07 +00:00
parent 6307a00750
commit 859be3923f
29 changed files with 249 additions and 103 deletions

View File

@ -9,7 +9,7 @@ Standards-Version: 3.8.0
Package: lemonldap-ng Package: lemonldap-ng
Architecture: all Architecture: all
Depends: liblemonldap-ng-handler-perl (= ${binary:Version}), liblemonldap-ng-manager-perl (= ${binary:Version}), liblemonldap-ng-portal-perl (= ${binary:Version}) Depends: ${misc:Depends}, liblemonldap-ng-handler-perl (= ${binary:Version}), liblemonldap-ng-manager-perl (= ${binary:Version}), liblemonldap-ng-portal-perl (= ${binary:Version})
Description: Lemonldap::NG Web-SSO system Description: Lemonldap::NG Web-SSO system
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
or directly on application Apache servers. or directly on application Apache servers.
@ -19,6 +19,7 @@ Description: Lemonldap::NG Web-SSO system
Package: lemonldap-ng-doc Package: lemonldap-ng-doc
Section: doc Section: doc
Architecture: all Architecture: all
Depends: ${misc:Depends}
Description: Lemonldap::NG Web-SSO system documentation Description: Lemonldap::NG Web-SSO system documentation
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
or directly on application Apache servers. or directly on application Apache servers.
@ -27,7 +28,7 @@ Description: Lemonldap::NG Web-SSO system documentation
Package: liblemonldap-ng-handler-perl Package: liblemonldap-ng-handler-perl
Architecture: all Architecture: all
Depends: libapache-session-perl, libwww-perl, libcache-cache-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libapache2-mod-perl2 | libapache-mod-perl Depends: ${misc:Depends}, libapache-session-perl, libwww-perl, libcache-cache-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libapache2-mod-perl2 | libapache-mod-perl
Suggests: liblemonldap-ng-portal-perl Suggests: liblemonldap-ng-portal-perl
Description: Lemonldap::NG Apache module part Description: Lemonldap::NG Apache module part
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
@ -49,7 +50,7 @@ Description: Lemonldap::NG Apache administration interface part
Package: liblemonldap-ng-manager-perl Package: liblemonldap-ng-manager-perl
Architecture: all Architecture: all
Depends: libxml-simple-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libjs-jquery, liblemonldap-ng-handler-perl (= ${binary:Version}) Depends: ${misc:Depends}, libxml-simple-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libjs-jquery, liblemonldap-ng-handler-perl (= ${binary:Version})
Recommends: libcache-cache-perl, libapache-session-perl, libsoap-lite-perl Recommends: libcache-cache-perl, libapache-session-perl, libsoap-lite-perl
Description: Lemonldap::NG Apache manager part Description: Lemonldap::NG Apache manager part
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
@ -59,7 +60,7 @@ Description: Lemonldap::NG Apache manager part
Package: liblemonldap-ng-portal-perl Package: liblemonldap-ng-portal-perl
Architecture: all Architecture: all
Depends: libapache-session-perl, libnet-ldap-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libhtml-template-perl, libjs-jquery, liblemonldap-ng-handler-perl (= ${binary:Version}), libxml-libxml-perl, libxml-libxslt-perl Depends: ${misc:Depends}, libapache-session-perl, libnet-ldap-perl, liblemonldap-ng-conf-perl (= ${binary:Version}), libhtml-template-perl, libjs-jquery, liblemonldap-ng-handler-perl (= ${binary:Version}), libxml-libxml-perl, libxml-libxslt-perl
Suggests: liblasso-perl, libcgi-session-perl, slapd Suggests: liblasso-perl, libcgi-session-perl, slapd
Description: Lemonldap::NG Apache authentication portal part Description: Lemonldap::NG Apache authentication portal part
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies

View File

@ -12,6 +12,7 @@ requires:
CGI: 3.08 CGI: 3.08
Crypt::Rijndael: 0 Crypt::Rijndael: 0
DBI: 0 DBI: 0
IO::String: 0
Regexp::Assemble: 0 Regexp::Assemble: 0
SOAP::Lite: 0 SOAP::Lite: 0
Storable: 0 Storable: 0

View File

@ -27,6 +27,7 @@ WriteMakefile(
'Storable' => 0, 'Storable' => 0,
'Regexp::Assemble' => 0, 'Regexp::Assemble' => 0,
'Cache::Cache' => 0, 'Cache::Cache' => 0,
'IO::String' => 0,
'SOAP::Lite' => 0, 'SOAP::Lite' => 0,
'Crypt::Rijndael' => 0, 'Crypt::Rijndael' => 0,
}, # e.g., Module::Name => 1.1 }, # e.g., Module::Name => 1.1

View File

@ -91,7 +91,7 @@ sub soapTest {
Lemonldap::NG::Common::CGI::SOAPService->new( $obj || $self, @func ); Lemonldap::NG::Common::CGI::SOAPService->new( $obj || $self, @func );
Lemonldap::NG::Common::CGI::SOAPServer->dispatch_to($dispatcher) Lemonldap::NG::Common::CGI::SOAPServer->dispatch_to($dispatcher)
->handle($self); ->handle($self);
exit; $self->quit();
} }
} }
@ -179,7 +179,7 @@ sub startSyslog {
$self->{_syslog} = 1; $self->{_syslog} = 1;
} }
##@method protected void userLog(string mess, string level) ##@method void userLog(string mess, string level)
# Log user actions on Apache logs or syslog. # Log user actions on Apache logs or syslog.
# @param $mess string to log # @param $mess string to log
# @param $level level of log message # @param $level level of log message
@ -195,7 +195,7 @@ sub userLog {
} }
##@method void userInfo(string mess) ##@method void userInfo(string mess)
# Log user errors like "bad password". # Log non important user actions. Alias for userLog() with facility "info".
# @param $mess string to log # @param $mess string to log
sub userInfo { sub userInfo {
my ( $self, $mess ) = @_; my ( $self, $mess ) = @_;
@ -204,7 +204,8 @@ sub userInfo {
} }
##@method void userNotice(string mess) ##@method void userNotice(string mess)
# Log user actions like access and logout. # Log user actions like access and logout. Alias for userLog() with facility
# "warn".
# @param $mess string to log # @param $mess string to log
sub userNotice { sub userNotice {
my ( $self, $mess ) = @_; my ( $self, $mess ) = @_;
@ -213,7 +214,8 @@ sub userNotice {
} }
##@method void userError(string mess) ##@method void userError(string mess)
# Log user errors like "bad password". # Log user errors like "bad password". Alias for userLog() with facility
# "error".
# @param $mess string to log # @param $mess string to log
sub userError { sub userError {
my ( $self, $mess ) = @_; my ( $self, $mess ) = @_;
@ -237,6 +239,12 @@ sub _sub {
} }
} }
## @method private void quit()
# Simply exit.
sub quit {
exit;
}
1; 1;
__END__ __END__

View File

@ -12,6 +12,8 @@ use base qw(SOAP::Transport::HTTP::Server);
our $VERSION = '0.2'; our $VERSION = '0.2';
## @method protected void DESTROY()
# Call SOAP::Trace::objects().
sub DESTROY { SOAP::Trace::objects('()') } sub DESTROY { SOAP::Trace::objects('()') }
## @cmethod Lemonldap::NG::Common::CGI::SOAPServer new(@param) ## @cmethod Lemonldap::NG::Common::CGI::SOAPServer new(@param)

View File

@ -17,10 +17,10 @@ my $h;
ok( ok(
$h = new Lemonldap::NG::Common::Conf( $h = new Lemonldap::NG::Common::Conf(
{ {
type => 'File', type => 'File',
dirName => ".", dirName => ".",
} }
), ),
'type => file', 'type => file',
); );

View File

@ -17,13 +17,13 @@ my $h;
@ARGV = ("help=groups"); @ARGV = ("help=groups");
ok( ok(
$h = new Lemonldap::NG::Common::Conf( $h = new Lemonldap::NG::Common::Conf(
{ {
type => 'DBI', type => 'DBI',
dbiChain => "DBI:mysql:database=lemonldap-ng", dbiChain => "DBI:mysql:database=lemonldap-ng",
dbiUser => 'lemonldap-ng', dbiUser => 'lemonldap-ng',
} }
) )
); );
ok( $h->can( 'dbh' ) ); ok( $h->can('dbh') );

View File

@ -19,14 +19,14 @@ SKIP: {
my $h; my $h;
ok( ok(
$h = new Lemonldap::NG::Common::Conf( $h = new Lemonldap::NG::Common::Conf(
{ {
type => 'SOAP', type => 'SOAP',
proxy => 'http://localhost', proxy => 'http://localhost',
} }
) )
); );
ok( $h->can( '_connect' ) ); ok( $h->can('_connect') );
ok( $h->can( '_soapCall' ) ); ok( $h->can('_soapCall') );
} }
######################### #########################

View File

@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print'; # change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 1; use Test::More tests => 1;
BEGIN { use_ok('Lemonldap::NG::Common') }; BEGIN { use_ok('Lemonldap::NG::Common') }
######################### #########################

View File

@ -6,15 +6,51 @@
# change 'tests => 1' to 'tests => last_test_to_print'; # change 'tests => 1' to 'tests => last_test_to_print';
package My::Portal; package My::Portal;
use Test::More tests => 7; use strict;
use IO::String;
use Test::More tests => 10;
BEGIN { use_ok('Lemonldap::NG::Common::CGI') } BEGIN { use_ok('Lemonldap::NG::Common::CGI') }
our @ISA = ('Lemonldap::NG::Common::CGI'); use base ('Lemonldap::NG::Common::CGI');
sub subtest { sub subtest {
return 'OK1'; return 'OK1';
} }
sub abort {
shift;
$, = '';
print STDERR @_;
die 'abort has been called';
}
sub quit {
2;
}
our $param;
sub param {
return $param;
}
sub soapfunc {
return 'SoapOK';
}
our $buf;
tie *STDOUT, 'IO::String', $buf;
our $lastpos = 0;
sub diff {
my $str = $buf;
$str =~ s/^.{$lastpos}//s if ($lastpos);
$str =~ s/\r//gs;
$lastpos = length $buf;
return $str;
}
######################### #########################
# Insert your test code below, the Test::More module is use()ed here so read # Insert your test code below, the Test::More module is use()ed here so read
@ -22,19 +58,16 @@ sub subtest {
my $cgi; my $cgi;
ok( ( $cgi = My::Portal->new() ), 'New CGI' );
use IO::String;
our $buf;
#tie *STDOUT, 'IO::String', $buf;
$ENV{SCRIPT_NAME} = '/test.pl'; $ENV{SCRIPT_NAME} = '/test.pl';
$ENV{SCRIPT_FILENAME} = 't/20-Common-CGI.t'; $ENV{SCRIPT_FILENAME} = 't/20-Common-CGI.t';
$ENV{REQUEST_METHOD} = 'GET'; $ENV{REQUEST_METHOD} = 'GET';
$ENV{REQUEST_URI} = '/'; $ENV{REQUEST_URI} = '/';
$ENV{QUERY_STRING} = ''; $ENV{QUERY_STRING} = '';
#$cgi = CGI->new;
ok( ( $cgi = Lemonldap::NG::Common::CGI->new() ), 'New CGI' );
bless $cgi, 'My::Portal';
# Test header_public # Test header_public
ok( $buf = $cgi->header_public('t/20-Common-CGI.t'), 'header_public' ); ok( $buf = $cgi->header_public('t/20-Common-CGI.t'), 'header_public' );
ok( $buf =~ /Cache-control: public; must-revalidate; max-age=\d+\r?\n/s, ok( $buf =~ /Cache-control: public; must-revalidate; max-age=\d+\r?\n/s,
@ -46,3 +79,19 @@ ok( $cgi->_sub('subtest') eq 'OK1', '_sub mechanism 1' );
$cgi->{subtest} = sub { return 'OK2' }; $cgi->{subtest} = sub { return 'OK2' };
ok( $cgi->_sub('subtest') eq 'OK2', '_sub mechanism 2' ); ok( $cgi->_sub('subtest') eq 'OK2', '_sub mechanism 2' );
# SOAP
SKIP: {
eval { require SOAP::Lite };
skip
"SOAP::Lite is not installed, so CGI SOAP functions will not work", 3
if ($@);
$ENV{HTTP_SOAPACTION} =
'http://localhost/Lemonldap/NG/Common/CGI/SOAPService#soapfunc';
$param =
'<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soapfunc xmlns="http://localhost/Lemonldap/NG/Common/CGI/SOAPService"><var xsi:type="xsd:string">fr</var></soapfunc></soap:Body></soap:Envelope>';
ok( $cgi->soapTest('soapfunc') == 2, 'SOAP call exit fine' );
my $tmp = diff();
ok( $tmp =~ /^Status: 200/s, 'HTTP response 200' );
ok( $tmp =~ /<result xsi:type="xsd:string">SoapOK<\/result>/s,
'result of SOAP call' );
}

View File

@ -32,7 +32,7 @@ BEGIN {
} }
} }
## @cmethod int run(Apache2::RequestRec apacheRequest) ## @rmethod int run(Apache2::RequestRec apacheRequest)
# overload run subroutine to implement Auth-Basic mechanism. # overload run subroutine to implement Auth-Basic mechanism.
# @param $apacheRequest current request # @param $apacheRequest current request
# @return Apache constant # @return Apache constant

View File

@ -16,7 +16,7 @@ use base qw(Lemonldap::NG::Handler::SharedConf);
*EXPORT_TAGS = *Lemonldap::NG::Handler::SharedConf::EXPORT_TAGS; *EXPORT_TAGS = *Lemonldap::NG::Handler::SharedConf::EXPORT_TAGS;
*EXPORT_OK = *Lemonldap::NG::Handler::SharedConf::EXPORT_OK; *EXPORT_OK = *Lemonldap::NG::Handler::SharedConf::EXPORT_OK;
## @cmethod int run(Apache2::RequestRec apacheRequest) ## @rmethod int run(Apache2::RequestRec apacheRequest)
# overload run subroutine to implement cross-domain mechanism. # overload run subroutine to implement cross-domain mechanism.
# @param $apacheRequest # @param $apacheRequest
# @return Apache constant # @return Apache constant

View File

@ -146,7 +146,7 @@ sub goToPortal {
exit; exit;
} }
## @fn string private _uri() ## @fn private string _uri()
# Builds current URL including "http://" and server name. # Builds current URL including "http://" and server name.
# @return URL_string # @return URL_string
sub _uri { sub _uri {

View File

@ -6,11 +6,11 @@
# change 'tests => 1' to 'tests => last_test_to_print'; # change 'tests => 1' to 'tests => last_test_to_print';
BEGIN { BEGIN {
our $home=0; our $home = 0;
$home++ if($ENV{DEBFULLNAME} and $ENV{DEBFULLNAME} eq 'Xavier Guimard'); $home++ if ( $ENV{DEBFULLNAME} and $ENV{DEBFULLNAME} eq 'Xavier Guimard' );
} }
use Test::More tests => 1 + 8*$home; use Test::More tests => 1 + 8 * $home;
BEGIN { use_ok( 'Lemonldap::NG::Handler::Simple', ':all' ) } BEGIN { use_ok( 'Lemonldap::NG::Handler::Simple', ':all' ) }
######################### #########################
@ -18,7 +18,7 @@ BEGIN { use_ok( 'Lemonldap::NG::Handler::Simple', ':all' ) }
# Insert your test code below, the Test::More module is use()ed here so read # Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script. # its man page ( perldoc Test::More ) for help writing this test script.
exit unless($home); exit unless ($home);
my $h; my $h;
$h = bless {}, 'Lemonldap::NG::Handler::Simple'; $h = bless {}, 'Lemonldap::NG::Handler::Simple';
@ -50,8 +50,10 @@ ok( close($statusPipe) );
sub read { sub read {
my $ok = 0; my $ok = 0;
#open LOG, '>/tmp/log'; #open LOG, '>/tmp/log';
while (<$statusOut>) { while (<$statusOut>) {
#print LOG $_; #print LOG $_;
$ok++ if (/^OK\s+:\s*2\s*\(2\.00\s*\/\s*mn\)$/); $ok++ if (/^OK\s+:\s*2\s*\(2\.00\s*\/\s*mn\)$/);
$ok++ if (/^REJECT\s+:\s*1\s*\(1\.00\s*\/\s*mn\)$/); $ok++ if (/^REJECT\s+:\s*1\s*\(1\.00\s*\/\s*mn\)$/);
@ -60,6 +62,7 @@ sub read {
last; last;
} }
} }
#print LOG "$ok\n"; #print LOG "$ok\n";
#close LOG; #close LOG;
return ( $ok == 3 ); return ( $ok == 3 );

View File

@ -29,9 +29,9 @@ ok(
type => "File", type => "File",
dirName => '/tmp/', dirName => '/tmp/',
}, },
https => 0, https => 0,
portal => 'http://auth.example.com', portal => 'http://auth.example.com',
globalStorage => 'Apache::Session::File', globalStorage => 'Apache::Session::File',
} }
), ),
'Portal object' 'Portal object'

View File

@ -233,7 +233,7 @@ sub printXmlConf {
); );
} }
# @method protected hashRef buildTree(array p) ## @method protected hashRef buildTree(array p)
# Transform Lemonldap::NG configuration into a tree that javascript library can # Transform Lemonldap::NG configuration into a tree that javascript library can
# understand. # understand.
# @param @p parameters given to Lemonldap::NG::Common::Conf::getConf() # @param @p parameters given to Lemonldap::NG::Common::Conf::getConf()

View File

@ -40,7 +40,7 @@ sub new {
return $self; return $self;
} }
## @rmethod void process() ## @method void process()
# Main method. # Main method.
sub process { sub process {
my $self = shift; my $self = shift;
@ -375,7 +375,7 @@ sub process {
} }
} }
## @rfn protected string htmlquote(string s) ## @fn protected string htmlquote(string s)
# Change <, > and & to HTML encoded values in the string # Change <, > and & to HTML encoded values in the string
# @param $s HTML string # @param $s HTML string
# @return HTML string # @return HTML string
@ -387,7 +387,7 @@ sub htmlquote {
return $s; return $s;
} }
## @rfn protected void start() ## @fn protected void start()
# Display HTTP and HTML headers. # Display HTTP and HTML headers.
sub start { sub start {
my $self = shift; my $self = shift;
@ -446,7 +446,7 @@ sub start {
); );
} }
## @rfn protected void ajaxnode(string id, string text, string param) ## @fn protected void ajaxnode(string id, string text, string param)
# Display tree node with Ajax functions inside for opening the node. # Display tree node with Ajax functions inside for opening the node.
# @param $id HTML id of the element. # @param $id HTML id of the element.
# @param $text text to display # @param $text text to display
@ -457,7 +457,7 @@ sub ajaxNode {
"<li id=\"$id\"><span>$text</span>\n<ul class=\"ajax\"><li id=\"sub_$id\">{url:$ENV{SCRIPT_NAME}?$param}</li></ul></li>\n"; "<li id=\"$id\"><span>$text</span>\n<ul class=\"ajax\"><li id=\"sub_$id\">{url:$ENV{SCRIPT_NAME}?$param}</li></ul></li>\n";
} }
## @rfn protected void window(string root) ## @fn protected void window(string root)
# Design the main window # Design the main window
# @param $root Text to display in the root node of the tree # @param $root Text to display in the root node of the tree
sub window { sub window {
@ -481,7 +481,7 @@ sub window {
. '</span><ul>'; . '</span><ul>';
} }
## @rfn protected void end() ## @fn protected void end()
# Display the end of HTML page. # Display the end of HTML page.
sub end { sub end {
my $self = shift; my $self = shift;
@ -492,7 +492,7 @@ sub end {
1; 1;
## @rfn protected css() ## @fn protected css()
# Display the main CSS file (called by http://manager.example.com/sessions.pl/css) # Display the main CSS file (called by http://manager.example.com/sessions.pl/css)
sub css { sub css {
my $self = shift; my $self = shift;
@ -679,7 +679,7 @@ body
EOF EOF
} }
## @rfn protected js() ## @fn protected js()
# Display the main javascript file (called by http://manager.example.com/sessions.pl/js) # Display the main javascript file (called by http://manager.example.com/sessions.pl/js)
sub js { sub js {
my $self = shift; my $self = shift;

View File

@ -25,10 +25,9 @@ our $lastpos = 0;
sub diff { sub diff {
my $str = $buf; my $str = $buf;
$str =~ s/^.{$lastpos}//s if($lastpos); $str =~ s/^.{$lastpos}//s if ($lastpos);
$str =~ s/\r//gs; $str =~ s/\r//gs;
$lastpos = length $buf; $lastpos = length $buf;
print STDERR "DEBUG $str\n";
return $str; return $str;
} }
@ -52,13 +51,8 @@ ok( $h->start_html() =~ /<html/s, 'start_html' );
ok( ( $h->main() and diff() =~ m#<script type="text/javascript"# ), 'main' ); ok( ( $h->main() and diff() =~ m#<script type="text/javascript"# ), 'main' );
ok( $h->end_html() =~ m#</html>#, 'end_html' ); ok( $h->end_html() =~ m#</html>#, 'end_html' );
ok( ( $h->print_css() and diff() =~ m#Content-Type:\s+text/css#s ), 'css' ); ok( ( $h->print_css() and diff() =~ m#Content-Type:\s+text/css#s ), 'css' );
ok( ok( ( $h->print_lmjs() and diff() =~ m#Content-Type:\s+text/javascript#s ),
( 'javascript' );
$h->print_lmjs()
and diff() =~ m#Content-Type:\s+text/javascript#s
),
'javascript'
);
ok( $h->print_help(), 'help' ); ok( $h->print_help(), 'help' );
ok( ref( $h->buildTree() ) eq 'HASH', 'buildTree' ); ok( ref( $h->buildTree() ) eq 'HASH', 'buildTree' );
my $tmp = &xml; my $tmp = &xml;

View File

@ -16,9 +16,9 @@ use Test::More tests => ( keys(%lang) + 4 );
use_ok('Lemonldap::NG::Manager'); use_ok('Lemonldap::NG::Manager');
my $win = 0; my $win = 0;
$win ++ unless( -e '/dev/null' ); $win++ unless ( -e '/dev/null' );
if($win) { if ($win) {
open STDOUT, '>test_stdout.txt'; open STDOUT, '>test_stdout.txt';
} }
else { else {
@ -53,7 +53,7 @@ ok( $h->main(), "HTML code" );
ok( $h->print_help(), "Help page" ); ok( $h->print_help(), "Help page" );
ok( $h->buildTree(), "XML tree" ); ok( $h->buildTree(), "XML tree" );
unlink('test_stdout.txt') if($win); unlink('test_stdout.txt') if ($win);
sub compare { sub compare {
my ( $l1, $l2 ) = @_; my ( $l1, $l2 ) = @_;

View File

@ -11,27 +11,31 @@ use Test::More tests => 3;
# not run. # not run.
SKIP: { SKIP: {
eval { require SOAP::Transport::HTTP }; eval { require SOAP::Transport::HTTP };
skip "SOAP::Transport::HTTP is not installed, so Lemonldap::NG::Manager::SOAPServer will not be useable", skip
"SOAP::Transport::HTTP is not installed, so Lemonldap::NG::Manager::SOAPServer will not be useable",
3 3
if ($@); if ($@);
use_ok('Lemonldap::NG::Manager::SOAPServer'); use_ok('Lemonldap::NG::Manager::SOAPServer');
my $s; my $s;
ok ( $s = Lemonldap::NG::Manager::SOAPServer->new ( ok(
type => 'config', $s = Lemonldap::NG::Manager::SOAPServer->new(
type => 'config',
configStorage => { configStorage => {
type => 'File', type => 'File',
dirName => '.', dirName => '.',
} }
) )
); );
eval { require Apache::Session::File }; eval { require Apache::Session::File };
skip "Apache::Session::File is not installed. Lemonldap::NG::Manager::SOAPServer will not be tested in 'sessions' mode", skip
"Apache::Session::File is not installed. Lemonldap::NG::Manager::SOAPServer will not be tested in 'sessions' mode",
1 1
if ($@); if ($@);
ok ( $s = Lemonldap::NG::Manager::SOAPServer->new ( ok(
type => 'sessions', $s = Lemonldap::NG::Manager::SOAPServer->new(
type => 'sessions',
realSessionStorage => 'Apache::Session::File', realSessionStorage => 'Apache::Session::File',
) )
); );
} }

View File

@ -107,6 +107,7 @@ README
t/01-Lemonldap-NG-Portal-Simple.t t/01-Lemonldap-NG-Portal-Simple.t
t/02-Lemonldap-NG-Portal-SharedConf.t t/02-Lemonldap-NG-Portal-SharedConf.t
t/03-XSS-protection.t t/03-XSS-protection.t
t/04-Lemonldap-NG-Portal-SOAP.t
t/10-Lemonldap-NG-Portal-i18n.t t/10-Lemonldap-NG-Portal-i18n.t
t/20-Lemonldap-NG-Portal-AuthApache.t t/20-Lemonldap-NG-Portal-AuthApache.t
t/21-Lemonldap-NG-Portal-AuthSSL.t t/21-Lemonldap-NG-Portal-AuthSSL.t

View File

@ -12,6 +12,7 @@ requires:
CGI: 3.08 CGI: 3.08
CGI::Session: 0 CGI::Session: 0
HTML::Template: 0 HTML::Template: 0
IO::String: 0
Lemonldap::NG::Common: 0.9 Lemonldap::NG::Common: 0.9
Lemonldap::NG::Handler: 0.9 Lemonldap::NG::Handler: 0.9
Net::LDAP: 0 Net::LDAP: 0

View File

@ -41,7 +41,7 @@ sub extractFormInfo {
PE_OK; PE_OK;
} }
# @apmethod int authenticate() ## @apmethod int authenticate()
# Does nothing. # Does nothing.
# @return Lemonldap::NG::Portal constant # @return Lemonldap::NG::Portal constant
sub authenticate { sub authenticate {

View File

@ -1,8 +1,3 @@
##@file
# Cross domain extension for Lemonldap::NG portals.
##@class
# Cross domain extension for Lemonldap::NG portals.
package Lemonldap::NG::Portal::CDA; package Lemonldap::NG::Portal::CDA;
use strict; use strict;
@ -19,8 +14,6 @@ use base ('Lemonldap::NG::Portal::SharedConf');
# OVERLOADED SUB # # OVERLOADED SUB #
################## ##################
## @cmethod Lemonldap::NG::Portal::CDA new()
# @return Lemonldap::NG::Portal::CDA object
sub new { sub new {
my $class = shift; my $class = shift;
my $self = $class->SUPER::new(@_); my $self = $class->SUPER::new(@_);

View File

@ -43,10 +43,9 @@ sub getConf {
} }
## @method list getProtectedSites() ## @method list getProtectedSites()
# @return list list of protected virtual hosts.
# With SharedConf, $locationRules contains a hash table with virtual hosts as # With SharedConf, $locationRules contains a hash table with virtual hosts as
# keys. So we can use it to know all protected virtual hosts. # keys. So we can use it to know all protected virtual hosts.
# @return list list of protected virtual hosts.
sub getProtectedSites { sub getProtectedSites {
my $self = shift; my $self = shift;
my @tab = (); my @tab = ();
@ -55,6 +54,9 @@ sub getProtectedSites {
return (); return ();
} }
## @method private hashref _getLmConf()
# Call and return Lemonldap::NG::Common::Conf::getConf() value.
# @return Lemonldap::NG shared configuration
sub _getLmConf { sub _getLmConf {
my $self = shift; my $self = shift;
$self->{lmConf} = Lemonldap::NG::Common::Conf->new( $self->{configStorage} ) $self->{lmConf} = Lemonldap::NG::Common::Conf->new( $self->{configStorage} )

View File

@ -19,13 +19,16 @@ use Lemonldap::NG::Portal::_i18n; #inherits
use Safe; use Safe;
# Special comments for doxygen # Special comments for doxygen
#inherits Lemonldap::NG::Portal::_SOAP
#inherits Lemonldap::NG::Portal::AuthApache #inherits Lemonldap::NG::Portal::AuthApache
#inherits Lemonldap::NG::Portal::AuthCAS #inherits Lemonldap::NG::Portal::AuthCAS
#inherits Lemonldap::NG::Portal::AuthLDAP #inherits Lemonldap::NG::Portal::AuthLDAP
#inherits Lemonldap::NG::Portal::AuthRemote
#inherits Lemonldap::NG::Portal::AuthSSL #inherits Lemonldap::NG::Portal::AuthSSL
#inherits Lemonldap::NG::Portal::Menu #inherits Lemonldap::NG::Portal::Menu
#link Lemonldap::NG::Portal::Notification protected notification #link Lemonldap::NG::Portal::Notification protected notification
#inherits Lemonldap::NG::Portal::UserDBLDAP #inherits Lemonldap::NG::Portal::UserDBLDAP
#inherits Lemonldap::NG::Portal::UserDBRemote
#inherits Apache::Session #inherits Apache::Session
#link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage #link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage

View File

@ -12,10 +12,12 @@ require SOAP::Lite;
## @method void startSoapServices() ## @method void startSoapServices()
# Check the URI requested (PATH_INFO environment variable) and launch the # Check the URI requested (PATH_INFO environment variable) and launch the
# corresponding SOAP methods using soapTest(). # corresponding SOAP methods using soapTest().
# If "soapOnly" is set, reject otehr request. Else, simply return.
sub startSoapServices { sub startSoapServices {
my $self = shift; my $self = shift;
if ( if (
my $tmp = { $ENV{PATH_INFO}
and my $tmp = {
'/sessions' => 'getAttributes', '/sessions' => 'getAttributes',
'/adminSessions' => 'setAttributes newSession', '/adminSessions' => 'setAttributes newSession',
'/config' => 'getConfig' '/config' => 'getConfig'
@ -142,15 +144,13 @@ sub _buildSoapHash {
my @tmp = (); my @tmp = ();
@keys = keys %$h unless (@keys); @keys = keys %$h unless (@keys);
foreach (@keys) { foreach (@keys) {
if ( ref( $h->{$_} ) eq 'HASH' ) { if ( ref( $h->{$_} ) eq 'ARRAY' ) {
die;
push @tmp, SOAP::Data->name( $_ => _buildSoapHash( $h->{$_} ) );
}
elsif ( ref( $h->{$_} ) eq 'ARRAY' ) {
die;
push @tmp, push @tmp,
SOAP::Data->name( $_, \SOAP::Data->value( @{ $h->{$_} } ) ); SOAP::Data->name( $_, \SOAP::Data->value( @{ $h->{$_} } ) );
} }
elsif ( ref( $h->{$_} ) ) {
push @tmp, SOAP::Data->name( $_ => _buildSoapHash( $h->{$_} ) );
}
else { else {
push @tmp, SOAP::Data->name( $_, $h->{$_} )->type('string') push @tmp, SOAP::Data->name( $_, $h->{$_} )->type('string')
if ( defined( $h->{$_} ) ); if ( defined( $h->{$_} ) );

View File

@ -0,0 +1,84 @@
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Lemonldap-NG-Portal.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
package My::Portal;
use strict;
use IO::String;
use Test::More tests => 2;
BEGIN { use_ok( 'Lemonldap::NG::Portal::Simple', ':all' ) }
our @ISA = qw(Lemonldap::NG::Portal::Simple);
sub abort {
shift;
$, = '';
print STDERR @_;
die 'abort has been called';
}
sub quit {
2;
}
our $param;
sub param {
return $param;
}
sub soapfunc {
return 'SoapOK';
}
our $buf;
tie *STDOUT, 'IO::String', $buf;
our $lastpos = 0;
sub diff {
my $str = $buf;
$str =~ s/^.{$lastpos}//s if ($lastpos);
$str =~ s/\r//gs;
$lastpos = length $buf;
return $str;
}
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
my $p;
# CGI Environment
$ENV{SCRIPT_NAME} = '/test.pl';
$ENV{SCRIPT_FILENAME} = '/tmp/test.pl';
$ENV{REQUEST_METHOD} = 'GET';
$ENV{REQUEST_URI} = '/';
$ENV{QUERY_STRING} = '';
SKIP: {
eval { require SOAP::Lite };
skip "SOAP::Lite is not installed, so CGI SOAP functions will not work", 1
if ($@);
ok(
$p = Lemonldap::NG::Portal::Simple->new(
{
globalStorage => 'Apache::Session::File',
globalStorageOptions => {
Directory => '/tmp/',
LockDirectory => '/tmp/',
},
domain => 'example.com',
soap => 1,
}
),
'Portal object'
);
bless $p, 'My::Portal';
}

View File

@ -25,7 +25,7 @@ our $lastpos = 0;
sub diff { sub diff {
my $str = $buf; my $str = $buf;
$str =~ s/^.{$lastpos}//s if($lastpos); $str =~ s/^.{$lastpos}//s if ($lastpos);
$str =~ s/\r//gs; $str =~ s/\r//gs;
$lastpos = length $buf; $lastpos = length $buf;
return $str; return $str;
@ -33,7 +33,7 @@ sub diff {
sub abort { sub abort {
shift; shift;
local $,=' '; local $, = ' ';
print STDERR @_; print STDERR @_;
} }
@ -53,19 +53,18 @@ $ENV{QUERY_STRING} = '';
ok( ok(
$p = My::Portal->new( $p = My::Portal->new(
{ {
globalStorage => 'Apache::Session::File', globalStorage => 'Apache::Session::File',
domain => 'example.com', domain => 'example.com',
authentication => 'Remote', authentication => 'Remote',
portal => 'http://abc', portal => 'http://abc',
remotePortal => 'http://zz/', remotePortal => 'http://zz/',
remoteGlobalStorage => 'Apache::Session::File', remoteGlobalStorage => 'Apache::Session::File',
remoteGlobalStorageOptions => { remoteGlobalStorageOptions => { dirName => '.', },
dirName => '.',
},
} }
), ),
'Portal object' 'Portal object'
); );
ok(($p->process()==0 and $p->{error} == PE_BADCREDENTIALS), 'call goToPortal'); ok( ( $p->process() == 0 and $p->{error} == PE_BADCREDENTIALS ),
'call goToPortal' );