Supporte l'authentification basic (mod_authnz_ldap) pour les domaines

tags/0.2.5
Daniel Berteaud 12 years ago
parent 1bd33d142d
commit de457460c8
  1. 28
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content

@ -1,5 +1,9 @@
{
use esmith::util;
my $base = esmith::util::ldapBase($DomainName);
my $name = $domain->key;
my $target = $domain->prop('ProxyPassTarget') || '';
my $redirect = $domain->prop('Redirect') || '';
my $rewrite = $domain->prop('Rewrite') || '';
@ -7,6 +11,8 @@ my $allow = $domain->prop('AllowHosts') || '';
my $preserve = $domain->prop('ProxyPreserveHost') || 'no';
my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no';
my @env = split(/[;,]/, ($domain->prop('SetEnv') || ''));
my $auth = $domain->prop('Authentication') || 'none';
my @groups = split(/[;,]/, ($domain->prop('AllowGroups') || ''));
# ProxyPass ?
if ($target =~ m|https?://[\d\w\.\-/]*|){
@ -61,5 +67,27 @@ if ($allow ne ''){
EOF
}
if ($auth =~ m/^Basic$/i){
my $require = "Require valid-user";
if (scalar(@groups) > 0){
$require = "Require ldap-group ";
$require .= "cn=$_,ou=Groups,$base " foreach(@groups);
}
$OUT .=<<"EOF";
<Location />
AuthType basic
AuthName "$name"
AuthBasicProvider ldap
AuthLDAPURL ldap://localhost/ou=Users,$base?uid
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
$require
</location>
EOF
}
}

Loading…
Cancel
Save