Simple LDAP Interface
- simple class to authenticate through LDAP to Active Directory
SYNOPSIS
sub login : Regex('^login/(\w+)/(\w+)$') {
my ( $self, $c ) = @_;
my $lds = Hello::Logic::LDAP::Authorize::Simple->new(
ldap_domain => 'ldap.domain.ru',
global_user => "cn=BlaBla,ou=LaLaLAA,dc=domain,dc=ru",
global_pass => "your_password",
timeout => 3
);
$lds->setup();
my $auth = $lds->authenticate(
login => $c->req->captures->[0],
password => $c->req->captures->[1]
);
$c->response->body( $auth ? "Accepted" : "Denied" );
}
To access this action thought URL print in browser "domain.ru/login/your_login/your_password"
global_user - is the same as "dn" - distinguish name.
It is the root directory in Active Directory
structure which contains users information.
Users information contains at least users dn's (distinguish names).
global_pass - is the password for distinguish name.
ldap_domain - is a domain that can be accessed through LDAP protocol (ldap://).
timeout - When we try to connect to AD, we send request to it and wait for
response. If AD is in down and doesn't send us any response for a
"timeout"-time we drop the connection and crashes to confess.
FUNCTIONS
- setup
-
- setting up connection to Active Directory Arguments: none Returns: 1
- authenticate
-
- trying to authenticate at Active Directory Arguments: login => '...', Returns: 0|1 ldap_message->entries->[0] (all available user data retrieved from AD though LDAP)
AUTHOR
Chergik Andrey Vladimirovich
CONTACTS
email: andrey@chergik.ru
LICENSE
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.