LEMONLDAP::NG Doxygen in progress

This commit is contained in:
Xavier Guimard 2008-12-31 15:10:02 +00:00
parent d82314f6e0
commit bfab1a6e3b
26 changed files with 125 additions and 52 deletions

View File

@ -1,3 +1,10 @@
## @file
# Add get_key_from_all_sessions() function to Apache::Session modules.
# This file is used by Lemonldap::NG::Manager::Status and by the
# purgeCentralCache script.
#
# Warning, this works only with SQL databases, simple or Berkeley files (not
# for Apache::Session::Memcached for example)
package Lemonldap::NG::Common::Apache::Session;
use Storable qw(thaw);

View File

@ -1,3 +1,8 @@
## @file
# Client side of the SOAP proxy mechanism for Apache::Session modules
## @class
# Client side of the SOAP proxy mechanism for Apache::Session modules
package Lemonldap::NG::Common::Apache::Session::SOAP;
use strict;
@ -16,6 +21,9 @@ BEGIN {
# PUBLIC INTERFACE
## @cmethod Lemonldap::NG::Common::Apache::Session::SOAP TIEHASH(string session_id, hashRef args)
# Constructor for Perl TIE mechanism. See perltie(3) for more.
# @return Lemonldap::NG::Common::Apache::Session::SOAP object
sub TIEHASH {
my $class = shift;
@ -100,8 +108,8 @@ sub DESTROY {
$self->save;
}
# INTERNAL SUBROUTINES
## @method private SOAP::Lite _connect()
# @return The SOAP::Lite object. Build it at the first call.
sub _connect {
my $self = shift;
return $self->{service} if ( $self->{service} );
@ -113,29 +121,43 @@ sub _connect {
return $self->{service} = SOAP::Lite->ns( $self->{ns} )->proxy(@args);
}
## @method private $ _soapCall(string func, @args)
# @param $func remote function to call
# @param @args Functions parameters
# @return Result
sub _soapCall {
my $self = shift;
my $func = shift;
return $self->_connect->$func(@_)->result;
}
## @method hashRef get(string id)
# @param $id Apache::Session session ID.
# @return User datas
sub get {
my $self = shift;
my $id = shift;
return $self->{data} = $self->_soapCall( "get", $id );
}
## @method hashRef newsession()
# Build a new Apache::Session session.
# @return User datas (just the session ID)
sub newsession {
my $self = shift;
return $self->{data} = $self->_soapCall( "newsession" );
}
## @method boolean save()
# Save user datas if modified.
sub save {
my $self = shift;
return unless ($self->{modified});
return $self->_soapCall( "set", $self->{data}->{_session_id}, $self->{data} );
}
## @method boolean delete()
# Deletes the current session.
sub delete {
my $self = shift;
return $self->_soapCall( "delete", $self->{data}->{_session_id} );

View File

@ -1,10 +1,8 @@
## @file
# Base package for all Lemonldap::NG CGI
#
# @copy 2005, 2006, 2007, 2008, Xavier Guimard <x.guimard@free.fr>
## @class
# Base class for all Lemonldap::NG portal CGI
# Base class for all Lemonldap::NG CGI
package Lemonldap::NG::Common::CGI;
use strict;
@ -17,6 +15,10 @@ our $VERSION = '0.31';
use base qw(CGI);
## @method void soapTest(string soapFunctions)
# Check if request is a SOAP request. If it is, launch
# Lemonldap::NG::Common::CGI::SOAPServer and exit. Else simply return.
# @param $soapFunctions list of authorized functions.
sub soapTest {
my $self = shift;
my $soapFunctions = shift || $self->{SOAPFunctions};
@ -33,9 +35,17 @@ sub soapTest {
->handle($self);
exit;
}
return $self;
}
## @method string header_public(string filename)
# Implements the "304 Not Modified" HTTP mechanism.
# If HTTP request contains an "If-Modified-Since" header and if
# $filename was not modified since, prints the "304 Not Modified" response and
# exit. Else, launch CGI::header() with "Cache-Control" and "Last-Modified"
# headers.
# @param $filename Optional name of the reference file. Default
# $ENV{SCRIPT_FILENAME}.
# @return Common Gateway Interface standard response header
sub header_public {
my $self = shift;
my $filename = shift;
@ -80,6 +90,11 @@ sub header_public {
);
}
## @method void abort(string title, string text)
# Display an error message and exit.
# Used instead of die() in Lemonldap::NG CGIs.
# @param title Title of the error message
# @param text Optional text. Default: "See Apache's logs"
sub abort {
my $self = shift;
my $cgi = CGI->new;

View File

@ -1,9 +1,17 @@
## @file
# SOAP support for Lemonldap::NG::Common::CGI
## @class
# SOAP support for Lemonldap::NG::Common::CGI
package Lemonldap::NG::Common::CGI::SOAPServer;
use SOAP::Transport::HTTP;
use base 'SOAP::Transport::HTTP::Server';
use base qw(SOAP::Transport::HTTP::Server);
sub DESTROY { SOAP::Trace::objects('()') }
## @cmethod Lemonldap::NG::Common::CGI::SOAPServer new(@param)
# @param @param SOAP::Transport::HTTP::Server::new() parameters
# @return Lemonldap::NG::Common::CGI::SOAPServer object
sub new {
my $self = shift;
return $self if ref $self;
@ -15,6 +23,8 @@ sub new {
return $self;
}
## @method handle(CGI cgi)
#
sub handle {
my $self = shift->new;
my $cgi = shift;

View File

@ -1,7 +1,13 @@
## @file
# Alias for Lemonldap::NG::Handler::SharedConf
## @class
# Alias for Lemonldap::NG::Handler::SharedConf
package Lemonldap::NG::Handler;
our $VERSION = "0.9";
our @ISA = ('Lemonldap::NG::Handler::SharedConf');
use Lemonldap::NG::Handler::SharedConf;
use base qw(Lemonldap::NG::Handler::SharedConf);
1;

View File

@ -1,7 +1,5 @@
##@file
# Auth-basic authentication with Lemonldap::NG rights management
#
#@copy 2008 Xavier Guimard <x.guimard@free.fr>
##@class
# Auth-basic authentication with Lemonldap::NG rights management

View File

@ -1,7 +1,5 @@
##@file
# Cross-domain mechanism for handler
#
#@copy 2005, 2006, 2007, 2008 Xavier Guimard <x.guimard@free.fr>
##@class
# Cross-domain mechanism for handler

View File

@ -1,7 +1,5 @@
## @file
# Auto-protected CGI machanism
#
# @copy 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# Base class for auto-protected CGI

View File

@ -1,7 +1,5 @@
## @file
# Perl based proxy used to replace mod_proxy
#
# @copy 2005, 2006, 2007, 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# Perl based proxy used to replace mod_proxy

View File

@ -1,7 +1,5 @@
## @file
# Main handler.
#
# @copy 2005, 2006, 2007, 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# Main handler.

View File

@ -1,7 +1,5 @@
## @file
# Base file for Lemonldap::NG handlers
#
# @copy 2005, 2006, 2007, 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# Base class for Lemonldap::NG handlers.

View File

@ -1,7 +1,5 @@
## @file
# Status process mechanism
#
# @copy 2008 Xavier Guimard <x.guimard@free.fr>
package Lemonldap::NG::Handler::Status;

View File

@ -1,7 +1,5 @@
## @file
# Virtual host support mechanism
#
# @copy 2005, 2006, 2007, 2008 Xavier Guimard <x.guimard@free.fr>
## @class
# This class adds virtual host support for Lemonldap::NG handlers.

View File

@ -1,7 +1,13 @@
## @file
# Alias for Lemonldap::NG::SharedConf
## @class
# Alias for Lemonldap::NG::SharedConf
package Lemonldap::NG::Portal;
our $VERSION = "0.86";
our @ISA = ('Lemonldap::NG::Portal::SharedConf');
use Lemonldap::NG::Portal::SharedConf;
use base 'Lemonldap::NG::Portal::SharedConf';
1;

View File

@ -1,7 +1,5 @@
##@file
# Apache authentication backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# Apache authentication backend class

View File

@ -1,7 +1,5 @@
##@file
# CAS authentication backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# CAS authentication backend class

View File

@ -1,7 +1,5 @@
##@file
# LDAP authentication backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# LDAP authentication backend class

View File

@ -1,7 +1,5 @@
##@file
# SSL authentication backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# SSL authentication backend class

View File

@ -1,3 +1,8 @@
##@file
# Cross domain extension for Lemonldap::NG portals.
##@class
# Cross domain extension for Lemonldap::NG portals.
package Lemonldap::NG::Portal::CDA;
use strict;
@ -14,16 +19,17 @@ use base ('Lemonldap::NG::Portal::SharedConf');
# OVERLOADED SUB #
##################
# 2. Existing sessions are validated so users coming from an other domain
# are not re-prompted
## @method int existingSession()
# Existing sessions must not be reauthenticated in CDA usage
# @return Lemonldap::NG::Portal error code
sub existingSession {
my ( $self, $id, $datas ) = @_;
PE_DONE;
}
# 16. If the user was redirected to the portal, we will now redirect him
# to the requested URL. If it does not come from our domain, we add
# ID in URL
## @method int autoRedirect()
# Same as Lemonldap::NG::Portal::SharedConf::autoRedirect(), but add ID in URL
# if the user was redirected to the portal from another domain.
# @return Lemonldap::NG::Portal error code
sub autoRedirect {
my $self = shift;
my $tmp = $self->{domain};

View File

@ -1,7 +1,5 @@
##@file
# Menu for Lemonldap::NG portal
#
#@copy 2008 Clement OUDOT <clement@oodo.net> <coudot@linagora.com>
##@class
# Menu class for Lemonldap::NG portal

View File

@ -1,7 +1,5 @@
## @file
# Main portal for Lemonldap::NG portal
#
# @copy 2005, 2006, 2007, 2008, Xavier Guimard <x.guimard@free.fr>
## @class
# Main portal for Lemonldap::NG portal

View File

@ -1,7 +1,5 @@
##@file
# Base package for Lemonldap::NG portal
#
#@copy 2005, 2006, 2007, 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# Base class for Lemonldap::NG portal

View File

@ -1,7 +1,5 @@
##@file
# LDAP user database backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# LDAP user database backend class

View File

@ -1,3 +1,8 @@
##@file
# LDAP common functions
##@class
# LDAP common functions
package Lemonldap::NG::Portal::_LDAP;
use Net::LDAP;
@ -5,6 +10,9 @@ use base qw(Net::LDAP);
our $VERSION = '0.1';
## @cmethod Lemonldap::NG::Portal::_LDAP new(Lemonldap::NG::Portal::Simple portal)
# Build a Net::LDAP object using parameters issued from $portal
# @return Lemonldap::NG::Portal::_LDAP object
sub new {
my $class = shift;
my $portal = shift;
@ -49,13 +57,22 @@ sub new {
return $self;
}
# 6. LDAP bind with Lemonldap::NG account or anonymous unless defined
## @method Net::LDAP::Message bind(string dn, %args)
# Reimplementation of Net::LDAP::bind(). Connection is done :
# - with $dn and $args->{password} as dn/password if defined,
# - or with Lemonldap::NG account,
# - or with an anonymous bind.
# @param $dn LDAP distinguish name
# @param %args See Net::LDAP(3) manpage for more
# @return Net::LDAP::Message
sub bind {
my $self = shift;
my $mesg;
my ( $dn, %args ) = @_;
$dn ||= $self->{portal}->{managerDn};
$args{password} ||= $self->{portal}->{managerPassword};
unless($dn) [
$dn = $self->{portal}->{managerDn};
$args{password} = $self->{portal}->{managerPassword};
}
if ( $dn && $args{password} ) {
$mesg = $self->SUPER::bind( $dn, %args );
}

View File

@ -1,7 +1,5 @@
##@file
# Web form authentication backend file
#
#@copy 2008, Xavier Guimard <x.guimard@free.fr>
##@class
# Web form authentication backend class

View File

@ -1,3 +1,8 @@
##@file
# Internationalization for Lemonldap::NG portal
##@class
# Internationalization for Lemonldap::NG portal
package Lemonldap::NG::Portal::_i18n;
# Developpers warning : this file must stay UTF-8 encoded
@ -5,6 +10,10 @@ package Lemonldap::NG::Portal::_i18n;
use AutoLoader qw(AUTOLOAD);
our $VERSION = '0.3';
## @fn string error(int error,string lang)
# @param $error Number of error to resolve
# @param $lang Language or Accepted-Language HTTP header string
# @return Error string for the $code in the $lang language
sub error {
my ( $error, $lang ) = @_;
$lang = lc($lang);
@ -70,6 +79,9 @@ __END__
# * PE_DONE -1
# * PE_REDIRECT -2
## @fn private arrayRef error_fr()
# French translation.
# @return Array of error messages
sub error_fr {
use utf8;
[
@ -114,6 +126,9 @@ sub error_fr {
];
}
## @fn private arrayRef error_en()
# English translation.
# @return Array of error messages
sub error_en {
[
"User authenticated",
@ -157,6 +172,9 @@ sub error_en {
];
}
## @fn private arrayRef error_ro()
# Romanian translation.
# @return Array of error messages
sub error_ro {
use utf8;
[