# 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" } #### :Simple::ActiveDirectory::authenticate was an 'undef', which is not one of the allowed types: scalar at C:/Strawberry/perl/site/lib/Authen/Simple/Adapter.pm line 42, line 755. Authen::Simple::Adapter::authenticate(undef, undef, undef) called at C:\Users\Documents\Perl\webapp\bin\app.psgi line 26 require C:\Users\Documents\Perl\webapp\bin\app.psgi called at (eval 6) line 3 eval 'package Plack::Sandbox::C_3a_5cUsers_5c503004671_5cDocuments_5cPerl_5cSynchrony_2dPerl_5cwebapp_5cbin_5capp_2epsgi; { my $app = do $_file; if ( !$app && ( my $error = $@ || $! )) { die $error; } $app; } ' called at C:/Strawberry/perl/site/lib/Plack/Util.pm line 120 Plack::Util::_load_sandbox("C:\\Users\\Documents\\Perl\\webapp\\bin\\a"...) called at C:/Strawberry/perl/site/lib/Plack/Util.pm line 136 Plack::Util::load_psgi("app.psgi") called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 181 Plack::Runner::__ANON__() called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 24 Plack::Runner::__ANON__() called at C:/Strawberry/perl/site/lib/Plack/Loader.pm line 55 Plack::Loader::preload_app(Plack::Loader=HASH(0x65aa50), CODE(0x2ca34c0)) called at C:/Strawberry/perl/site/lib/Plack/Runner.pm line 276 Plack::Runner::run(Plack::Runner=HASH(0x11aa248)) called at C:\Strawberry\perl\site\bin/plackup line 7