使用モジュール名: Authen::Simple::ActiveDirectory
URL: http://search.cpan.org/~chansen/Authen-Simple-LDAP-0.3/lib/Authen/Simple/ActiveDirectory.pm
予め、cpanmコマンドで上記モジュールをインストールします。
下記を認証のサンプルに使用してください。
test_ad.pl
use warnings;
use strict;
use 5.010;
use Authen::Simple::ActiveDirectory;
my $host = 'your_AD_address';
my $ad = Authen::Simple::ActiveDirectory->new(
host => $host,
principal => 'your_domain'
);
my $username = 'yasuhiro';
my $password = 'password';
if ( $ad->authenticate( $username, $password ) ) {
# successfull authentication
say 'success';
} else {
say 'fail';
}