{

use esmith::util;
my $base = esmith::util::ldapBase($DomainName);
my $auth = $dokuwiki{'Authentication'} || 'ldap';
my $ldapPort = $ldap{'TCPPort'} || '389';

if ($auth eq 'internal'){
    $OUT .=<<"EOF";

\$conf['authtype'] = 'authplain';

EOF

}
elsif ($auth eq 'ldap'){
    $OUT .=<<"EOF";

\$conf['authtype'] = 'authldap';

EOF

}
elsif ($auth eq 'LemonLDAP'){
    $OUT .=<<"EOF";

\$conf['authtype'] = 'authhttpldap';

EOF

}

if ($auth eq 'LemonLDAP' or $auth eq 'ldap'){
    $OUT .=<<"EOF";

\$conf['plugin'][\$conf['authtype']]['server'] = "ldap://localhost:$ldapPort";
\$conf['plugin'][\$conf['authtype']]['version'] = '3';
\$conf['plugin'][\$conf['authtype']]['usertree'] = 'ou=Users,$base';
\$conf['plugin'][\$conf['authtype']]['grouptree'] = 'ou=Groups,$base';
\$conf['plugin'][\$conf['authtype']]['userfilter'] = '(&(uid=%{user})(objectClass=inetOrgPerson))';
\$conf['plugin'][\$conf['authtype']]['groupfilter'] = '(&(objectClass=mailboxRelatedObject)(memberUid=%{user}))';
\$conf['plugin'][\$conf['authtype']]['groupkey'] = 'cn';

EOF

}

}

