Little corrections
This commit is contained in:
parent
4f9bb88369
commit
91844e41be
|
@ -1,5 +1,8 @@
|
|||
Revision history for Perl extension Lemonldap::NG::Handler.
|
||||
|
||||
0.74
|
||||
- unprotect system
|
||||
|
||||
0.73 Thu Jan 4 15:34:22 2007
|
||||
- In VirtualHost context, PerlInitHandler is an alias for
|
||||
PerlPostReadRequestHandler. So by encoding characters (%40 for 'a'),
|
||||
|
|
|
@ -6,7 +6,7 @@ use MIME::Base64;
|
|||
use Exporter 'import';
|
||||
use Safe;
|
||||
|
||||
our $VERSION = '0.73';
|
||||
our $VERSION = '0.74';
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
localStorage =>
|
||||
|
@ -519,7 +519,7 @@ sub cleanLocalStorage {
|
|||
return DECLINED;
|
||||
}
|
||||
|
||||
sub none {
|
||||
sub unprotect {
|
||||
DONE;
|
||||
}
|
||||
|
||||
|
@ -600,6 +600,11 @@ Call your package in <apache-directory>/conf/httpd.conf
|
|||
<Location /protected-area>
|
||||
PerlHeaderParserHandler My::Package
|
||||
</Location>
|
||||
|
||||
# You can also unprotect an URI
|
||||
<Files "*.gif">
|
||||
PerlHeaderParserHandler My::Package->unprotect
|
||||
</Files>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
|
|
@ -107,17 +107,17 @@ Create your own package:
|
|||
|
||||
__PACKAGE__->init ( { locationRules => {
|
||||
'vhost1.dc.com' => {
|
||||
'default' => '$ou =~ /brh/'
|
||||
},
|
||||
'vhost2.dc.com' => {
|
||||
'^/pj/.*$' => q($qualif="opj"),
|
||||
'^/rh/.*$' => q($ou=~/brh/),
|
||||
'^/rh_or_opj.*$' => q($qualif="opj or $ou=~/brh/),
|
||||
'default' => '$ou =~ /brh/'
|
||||
},
|
||||
'vhost2.dc.com' => {
|
||||
'^/pj/.*$' => q($qualif="opj"),
|
||||
'^/rh/.*$' => q($ou=~/brh/),
|
||||
'^/rh_or_opj.*$' => q($qualif="opj or $ou=~/brh/),
|
||||
default => 'accept',
|
||||
},
|
||||
# Put here others Lemonldap::NG::Handler::Simple options
|
||||
}
|
||||
);
|
||||
},
|
||||
# Put here others Lemonldap::NG::Handler::Simple options
|
||||
}
|
||||
);
|
||||
|
||||
Call your package in <apache-directory>/conf/httpd.conf
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ sub printXmlConf {
|
|||
text => &exportedVars,
|
||||
item => {},
|
||||
},
|
||||
macros => {
|
||||
text => ¯os,
|
||||
},
|
||||
macros => {
|
||||
text => ¯os,
|
||||
},
|
||||
ldapParameters => {
|
||||
text => &ldapParameters,
|
||||
item => {},
|
||||
|
@ -259,11 +259,11 @@ sub printXmlConf {
|
|||
}
|
||||
}
|
||||
if ( $config->{macros} ) {
|
||||
$tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item} = {};
|
||||
my $macros = $tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item};
|
||||
while ( my ( $macro, $expr ) = each( %{ $config->{macros} } ) ) {
|
||||
$macros->{$macro} = $self->xmlField( 'both', $expr, $macro );
|
||||
}
|
||||
$tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item} = {};
|
||||
my $macros = $tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item};
|
||||
while ( my ( $macro, $expr ) = each( %{ $config->{macros} } ) ) {
|
||||
$macros->{$macro} = $self->xmlField( 'both', $expr, $macro );
|
||||
}
|
||||
}
|
||||
|
||||
print XMLout(
|
||||
|
@ -339,7 +339,7 @@ sub upload {
|
|||
}
|
||||
while ( my ( $v, $h ) = each( %{ $tree->{generalParameters}->{macros} })) {
|
||||
next unless ( ref($h) );
|
||||
$config->{macros}->{ $h->{text} } = $h->{value};
|
||||
$config->{macros}->{ $h->{text} } = $h->{value};
|
||||
}
|
||||
foreach (qw(ldapBase ldapPort ldapServer managerDn managerPassword)) {
|
||||
$config->{$_} =
|
||||
|
|
|
@ -42,10 +42,14 @@ sub saveConf {
|
|||
$fields->{$k} = "'" . encode_base64( freeze($v) ) . "'";
|
||||
$fields->{$k} =~ s/[\r\n]//g;
|
||||
}
|
||||
elsif ( $v =~ /^\d+/ ) {
|
||||
elsif ( $v =~ /^\d+$/ ) {
|
||||
$fields->{$k} = "$v";
|
||||
}
|
||||
else {
|
||||
# mono-line
|
||||
$v =~ s/[\r\n]/ /gm;
|
||||
# trim
|
||||
$v =~ s/^\s*(.*?)\s*$/$1/;
|
||||
$fields->{$k} = "'$v'";
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +67,7 @@ sub getConf {
|
|||
my $tmp;
|
||||
eval "\$tmp = thaw(decode_base64($v))";
|
||||
if ( $@ or not($tmp) ) {
|
||||
$v =~ s/^'(.*)'$/$1/;
|
||||
$v =~ s/^'(.*)'$/$1/m;
|
||||
$conf->{$k} = $v;
|
||||
}
|
||||
else {
|
||||
|
@ -85,10 +89,10 @@ Web-SSO configuration.
|
|||
|
||||
use Lemonldap::NG::Manager::Conf;
|
||||
my $confAccess = new Lemonldap::NG::Manager::Conf(
|
||||
{
|
||||
type=>'File',
|
||||
dirName=>"/tmp/",
|
||||
},
|
||||
{
|
||||
type=>'File',
|
||||
dirName=>"/tmp/",
|
||||
},
|
||||
) or die "Unable to build Lemonldap::NG::Manager::Conf, see Apache logs";
|
||||
my $config = $confAccess->getConf();
|
||||
|
||||
|
@ -109,20 +113,20 @@ choosen type. Examples:
|
|||
|
||||
=item * B<File>:
|
||||
$confAccess = new Lemonldap::NG::Manager::Conf(
|
||||
{
|
||||
type => 'File',
|
||||
dirName => '/var/lib/lemonldap-ng/',
|
||||
});
|
||||
{
|
||||
type => 'File',
|
||||
dirName => '/var/lib/lemonldap-ng/',
|
||||
});
|
||||
|
||||
=item * B<DBI>:
|
||||
$confAccess = new Lemonldap::NG::Manager::Conf(
|
||||
{
|
||||
type
|
||||
dbiChain => 'DBI:mysql:database=lemonldap-ng,host=1.2.3.4',
|
||||
dbiUser => 'lemonldap'
|
||||
dbiPassword => 'pass'
|
||||
dbiTable => 'lmConfig',
|
||||
});
|
||||
type
|
||||
dbiChain => 'DBI:mysql:database=lemonldap-ng,host=1.2.3.4',
|
||||
dbiUser => 'lemonldap'
|
||||
dbiPassword => 'pass'
|
||||
dbiTable => 'lmConfig',
|
||||
});
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ sub javascript {
|
|||
Lemonldap::NG::Manager::_i18n::import( $ENV{HTTP_ACCEPT_LANGUAGE} );
|
||||
my %text;
|
||||
foreach(qw(newVirtualHost newMacro newGroup newVar newGSOpt saveConf
|
||||
deleteNode rules unableToSave confSaved saveFailure)) {
|
||||
deleteNode locationRules unableToSave confSaved saveFailure
|
||||
newRule newHeader)) {
|
||||
$text{$_} = &$_;
|
||||
}
|
||||
print <<EOT;
|
||||
|
@ -131,8 +132,8 @@ function onNodeSelect(nodeId) {
|
|||
if(nodeIs(nodeId,"virtualHosts")){
|
||||
but+=button('$text{newVirtualHost}','newVirtualHost',nodeId);
|
||||
if(nodeIs(nodeId,"virtualHost")){
|
||||
but+=button('Nouvelle règle','newRule',nodeId);
|
||||
but+=button('Nouvel en-tête','newHeader',nodeId);
|
||||
but+=button('$text{newRule}','newRule',nodeId);
|
||||
but+=button('$text{newHeader}','newHeader',nodeId);
|
||||
}
|
||||
help('virtualHosts');
|
||||
}
|
||||
|
@ -188,15 +189,15 @@ function insertNewChild(a,b,c) {
|
|||
}
|
||||
|
||||
function newVirtualHost() {
|
||||
var rep=prompt("Nouvel hôte virtuel");
|
||||
var rep=prompt("$newVirtualHost");
|
||||
if(rep) {
|
||||
insertNewChild('virtualHosts',rep,rep)
|
||||
tree.setUserData(rep,'modif','text');
|
||||
insertNewChild(rep,rep+'_exportedHeaders','Headers');
|
||||
insertNewChild(rep,rep+'_exportedHeaders','$text{httpHeaders}');
|
||||
insertNewChild(rep+'_exportedHeaders',rep+'_exportedHeaders_1','Auth-User');
|
||||
tree.setUserData(rep+'_exportedHeaders_1','modif','both');
|
||||
tree.setUserData(rep+'_exportedHeaders_1','value','\$uid');
|
||||
insertNewChild(rep,rep+'_locationRules','$text{rules}');
|
||||
insertNewChild(rep,rep+'_locationRules','$text{locationRules}');
|
||||
insertNewChild(rep+'_locationRules',rep+'_locationRules_default','default');
|
||||
tree.setUserData(rep+'_locationRules_default','modif','value');
|
||||
tree.setUserData(rep+'_locationRules_default','value','deny');
|
||||
|
|
|
@ -61,10 +61,11 @@ sub fr {
|
|||
newMacro => 'Nouvelle macro',
|
||||
newGroup => 'Nouveau groupe',
|
||||
newVar => 'Nouvelle variable',
|
||||
newRule => 'Nouvelle règle',
|
||||
newHeader => 'Nouvel en-tête',
|
||||
newGSOpt => 'Nouvelle option',
|
||||
saveConf => 'Sauvegarder',
|
||||
deleteNode => 'Supprimer',
|
||||
rules => 'Règles',
|
||||
unableToSave => 'Votre navigateur ne supporte pas les objets XMLHTTPRequest: sauvegarde impossible.',
|
||||
confSaved => 'Configuration sauvegardée sous le numéro',
|
||||
saveFailure => 'Échec de la sauvegarde',
|
||||
|
@ -99,6 +100,8 @@ sub en {
|
|||
newMacro => 'New Macro',
|
||||
newGroup => 'New Group',
|
||||
newVar => 'New Variable',
|
||||
newRule => 'New Rule',
|
||||
newHeader => 'New Header',
|
||||
newGSOpt => 'New Option',
|
||||
saveConf => 'Save',
|
||||
deleteNode => 'Delete',
|
||||
|
|
|
@ -20,7 +20,7 @@ system.
|
|||
use Lemonldap::NG::Portal::SharedConf;
|
||||
my $portal = new Lemonldap::NG::Portal::SharedConf (
|
||||
configStorage => {
|
||||
type => 'DBI',
|
||||
type => 'DBI',
|
||||
dbiChain => "dbi:mysql:database=lmSessions;host=1.2.3.4",
|
||||
dbiUser => "lemon",
|
||||
dbiPassword => "pass",
|
||||
|
|
|
@ -48,17 +48,17 @@ With Lemonldap::NG::Portal::Simple:
|
|||
|
||||
use Lemonldap::NG::Portal::Simple;
|
||||
my $portal = new Lemonldap::NG::Portal::Simple(
|
||||
domain => 'gendarmerie.defense.gouv.fr',
|
||||
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',
|
||||
globalStorageOptions => {
|
||||
DataSource => 'dbi:mysql:database',
|
||||
UserName => 'db_user',
|
||||
Password => 'db_password',
|
||||
TableName => 'sessions',
|
||||
},
|
||||
ldapServer => 'ldap.domaine.com',
|
||||
securedCookie => 1,
|
||||
authentication => 'SSL',
|
||||
);
|
||||
|
||||
if($portal->process()) {
|
||||
|
|
|
@ -64,8 +64,8 @@ sub new {
|
|||
|
||||
if ( $self->{authentication} eq "SSL" ) {
|
||||
require Lemonldap::NG::Portal::AuthSSL;
|
||||
# $Lemonldap::NG::Portal::AuthSSL::OVERRIDE does not overload $self
|
||||
# variables: if the administrator has defined a sub, we respect it
|
||||
# $Lemonldap::NG::Portal::AuthSSL::OVERRIDE does not overload $self
|
||||
# variables: if the administrator has defined a sub, we respect it
|
||||
%$self = ( %$Lemonldap::NG::Portal::AuthSSL::OVERRIDE, %$self );
|
||||
}
|
||||
return $self;
|
||||
|
@ -385,12 +385,12 @@ sub autoRedirect {
|
|||
#<head>
|
||||
#<script language="Javascript">
|
||||
#function redirect() {
|
||||
# document.location.href='$u';
|
||||
# document.location.href='$u';
|
||||
#}
|
||||
#</script>
|
||||
#</head>
|
||||
#<body onload="redirect();">
|
||||
# <h2>The document has moved <a href="$u">HERE</a></h2>
|
||||
# <h2>The document has moved <a href="$u">HERE</a></h2>
|
||||
#</body>
|
||||
#</html>
|
||||
#EOF
|
||||
|
@ -411,20 +411,20 @@ Lemonldap::NG::Portal::Simple - Base module for building Lemonldap::NG compatibl
|
|||
|
||||
use Lemonldap::NG::Portal::Simple;
|
||||
my $portal = new Lemonldap::NG::Portal::Simple(
|
||||
domain => 'gendarmerie.defense.gouv.fr',
|
||||
domain => 'gendarmerie.defense.gouv.fr',
|
||||
globalStorage => 'Apache::Session::MySQL',
|
||||
globalStorageOptions => {
|
||||
DataSource => 'dbi:mysql:database=dbname;host=127.0.0.1',
|
||||
UserName => 'db_user',
|
||||
Password => 'db_password',
|
||||
TableName => 'sessions',
|
||||
LockDataSource => 'dbi:mysql:database=dbname;host=127.0.0.1',
|
||||
LockUserName => 'db_user',
|
||||
LockPassword => 'db_password',
|
||||
},
|
||||
ldapServer => 'ldap.domaine.com',
|
||||
securedCookie => 1,
|
||||
exportedVars => ["uid","cn","mail","appli"],
|
||||
globalStorageOptions => {
|
||||
DataSource => 'dbi:mysql:database=dbname;host=127.0.0.1',
|
||||
UserName => 'db_user',
|
||||
Password => 'db_password',
|
||||
TableName => 'sessions',
|
||||
LockDataSource => 'dbi:mysql:database=dbname;host=127.0.0.1',
|
||||
LockUserName => 'db_user',
|
||||
LockPassword => 'db_password',
|
||||
},
|
||||
ldapServer => 'ldap.domaine.com',
|
||||
securedCookie => 1,
|
||||
exportedVars => ["uid","cn","mail","appli"],
|
||||
);
|
||||
|
||||
if($portal->process()) {
|
||||
|
|
Loading…
Reference in New Issue