# use this block if you don't need middleware, and only have a single target Dancer app to run here use webapp; use Plack::Builder; use Authen::Simple::ActiveDirectory; my $ad = Authen::Simple::ActiveDirectory->new( host => 'ldaps//ADDEV.dev.abc.com', principal => 'abc.com' ); builder { enable "Auth::Basic", authenticator => $ad; webapp->to_app; }; my($username, $password, $env) = @_; if ( $ad->authenticate( $username, $password ) ) { # successfull authentication } else { die "Wrong ID and Password\n" }