Support for Apache::Session::LDAP and little things

environments/ppa-mbqj77/deployments/1
Xavier Guimard 16 years ago
parent 7ac6d25eaf
commit 61866f20d6
  1. 42
      modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Apache/Session.pm
  2. 1
      modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/LDAP.pm
  3. 10
      modules/lemonldap-ng-manager/example/index.pl
  4. 12
      modules/lemonldap-ng-manager/example/sessions.pl

@ -7,6 +7,7 @@
# for Apache::Session::Memcached for example)
package Lemonldap::NG::Common::Apache::Session;
use strict;
use Storable qw(thaw);
BEGIN {
@ -89,6 +90,7 @@ BEGIN {
require Apache::Session::Serialize::PHP;
my $class = shift;
my $args = shift;
my $data = shift;
my $directory = $args->{SavePath} || '/tmp';
unless ( opendir DIR, $args->{SavePath} ) {
@ -103,7 +105,9 @@ BEGIN {
open F, "$args->{SavePath}/$f";
my $row = join '', <F>;
if ( ref($data) eq 'CODE' ) {
$res{$f} = &$data( Apache::Session::Serialize::PHP::unserialize($row), $f );
$res{$f} =
&$data( Apache::Session::Serialize::PHP::unserialize($row),
$f );
}
elsif ($data) {
$data = [$data] unless ( ref($data) );
@ -120,6 +124,7 @@ BEGIN {
sub Apache::Session::DB_File::get_key_from_all_sessions {
my $class = shift;
my $args = shift;
my $data = shift;
if ( !tied %{ $class->{dbm} } ) {
my $rv = tie %{ $class->{dbm} }, 'DB_File', $args->{FileName};
@ -142,12 +147,45 @@ BEGIN {
$res{$k} = thaw( $class->{dbm}->{$k} );
}
}
return \%res;
}
sub Apache::Session::LDAP::get_key_from_all_sessions {
my $class = shift;
my $args = shift;
my $data = shift;
my $ldap = Apache::Session::LDAP::Store::ldap( { args => $args } );
my $msg = $ldap->search(
base => $args->{ldapConfBase},
filter => '(objectClass=applicationProcess)',
scope => 'base',
attrs => [ 'cn', 'description' ],
);
Apache::Session::LDAP::Store->($msg) if ( $msg->code );
my %res;
foreach my $entry ( $msg->entries ) {
my ( $k, $v ) =
( $entry->get_value('cn'), $entry->get_value('description') );
if ( ref($data) eq 'CODE' ) {
$res{$k} = &$data( thaw($v), $k );
}
elsif ($data) {
$data = [$data] unless ( ref($data) );
my $tmp = thaw($v);
$res{$k}->{$_} = $tmp->{$_} foreach (@$data);
}
else {
$res{$k} = thaw($v);
}
}
return \%res;
}
sub Apache::Session::Memcached::get_key_from_all_sessions {
# TODO
die ('Apache::Session::Memcached is not supported by Lemonldap::NG');
die('Apache::Session::Memcached is not supported by Lemonldap::NG');
}
}

@ -55,6 +55,7 @@ sub lastCfg {
sub ldap {
my $self = shift;
return $self->{ldap} if($self->{ldap});
# Parse servers configuration
my $useTls = 0;

@ -13,6 +13,16 @@ my $h = new Lemonldap::NG::Manager(
inputSize => 30,
# OPTIONAL PARAMETERS
## PROTECTION, choose one of :
# * protection by manager
# protection => 'manager',
# * specify yourself the rule to apply (same as in the manager)
# protection => 'rule: $uid=admin',
# * all authenticate users are granted
# protection => 'authenticate',
# * nothing : not protected
#jsFile => /path/to/lemonldap-ng-manager.js,
# ACCESS TO CONFIGURATION

@ -11,17 +11,13 @@ our $cgi = Lemonldap::NG::Manager::Sessions->new({
imagePath => '/images/',
## PROTECTION, choose one of :
## * protection by manager
# * protection by manager
# protection => 'manager',
## * specify yourself the rule to apply (same as in the manager)
# * specify yourself the rule to apply (same as in the manager)
# protection => 'rule: $uid=admin',
## * all authenticate users are granted
# * all authenticate users are granted
# protection => 'authenticate',
## * nothing : not protected
# * nothing : not protected
# REDIRECTIONS
# You have to set this to explain to the handler if runs under SSL

Loading…
Cancel
Save