package Lemonldap::NG::Portal::AuthSSL; use strict; use Lemonldap::NG::Portal::Simple; our $VERSION = '0.04'; # Authentication is made by Apache with SSL and here before searching the LDAP # Directory. # So authenticate is overloaded to return only PE_OK. our $OVERRIDE = { # By default, authentication is valid if SSL_CLIENT_S_DN_Email environement # variable is present. Adapt it if you want extractFormInfo => sub { my $self = shift; $self->{user} = $self->https('SSL_CLIENT_S_DN_Email'); return PE_BADCREDENTIALS unless ( $self->{user} ); PE_OK; }, # As we know only user mail, we have to use it to find him in the LDAP # directory formateFilter => sub { my $self = shift; $self->{filter} = "(&(mail=" . $self->{user} . ")(objectClass=person))"; PE_OK; }, authenticate => sub { PE_OK; }, }; 1; __END__ =head1 NAME Lemonldap::NG::Portal::AuthSSL - Perl extension for building Lemonldap::NG compatible portals with SSL authentication. =head1 SYNOPSIS With Lemonldap::NG::Portal::SharedConf, set authentication field to "SSL" in configuration database. With Lemonldap::NG::Portal::Simple: use Lemonldap::NG::Portal::Simple; my $portal = new Lemonldap::NG::Portal::Simple( domain => 'gendarmerie.defense.gouv.fr', globalStorage => 'Apache::Session::MySQL', globalStorageOptions => { DataSource => 'dbi:mysql:database', UserName => 'db_user', Password => 'db_password', TableName => 'sessions', }, ldapServer => 'ldap.domaine.com', securedCookie => 1, authentication => 'SSL', ); if($portal->process()) { # Write here the menu with CGI methods. This page is displayed ONLY IF # the user was not redirected here. print $portal->header; # DON'T FORGET THIS (see CGI(3)) print "..."; # or redirect the user to the menu print $portal->redirect( -uri => 'https://portal/menu'); } else { # If the user enters here, IT MEANS THAT YOUR SSL PARAMETERS ARE BAD print $portal->header; # DON'T FORGET THIS (see CGI(3)) print "