- simple class to authenticate through LDAP to Active Directory
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.
- setting up connection to Active Directory Arguments: none Returns: 1
- trying to authenticate at Active Directory Arguments: login => '...', Returns: 0|1 ldap_message->entries->[0] (all available user data retrieved from AD though LDAP)
Chergik Andrey Vladimirovich
email: andrey@chergik.ru
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Authentication::Store::LDAP::AD::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Authentication::Store::LDAP::AD::Class
CPAN shell
perl -MCPAN -e shell install Catalyst::Authentication::Store::LDAP::AD::Class
For more information on module installation, please visit the detailed CPAN module installation guide.