LibreCat::Auth::LDAP - A LibreCat LDAP authentication package
use LibreCat::Auth::LDAP;
my $auth = LibreCat::Auth::LDAP->new(
host => 'ldaps://ldaps.ugent.be'
auth_base => 'ugentID=%s,ou=people,dc=UGent,dc=be'
);
if ($auth->authenticate({username => $username,
password => $password})) {
say "logged in";
}
else {
say "error";
}
The URL to the LDAP server. Use ldaps:// for a secure connection. Required
The base to use when authenticating user credentials. Required
When a double binding is required, the the bind parameters before checking user credentials.
An optional password required when doing a double binding.
Some LDAP servers may require you to lookup a user identifier. Set a search filter to lookup a user. E.g.
search_filter => '(uid=%s)'
The base to search with a search_filter. E.g.
search_base => 'dc=ugent, dc=be'
The attribute to return from a search filter. E.g.
search_attr: 'ugentID'
In the examples above a user name like 'einstein' will be searched as (uid=einstein) in the base 'dc=ugent, dc=be'. When a search result is found, then the login name will be translated to the 'ugentID' of the user.