I am attempting to use Dancer2::Plugin::Auth::ActiveDirectory and am receiving an error I can't figure out. Here is my code: (with unrelated routes removed)
package myApp; use Dancer2; use Dancer2::Plugin::Auth::ActiveDirectory; get '/loginForm' => sub { template 'loginForm' => { 'title' => 'loginForm' }; }; post '/loginPost' => sub { session 'user' => authenticate(params->{user}, params->{pass}) +; return template 'loggedIn' => {}; }; true;
And these are my settings in config.yml:
plugins: Auth::ActiveDirectory: host: xxx.xxx.xxx.xxx principal: 'OU=USER,OU=ACCOUNTS,OU=OUROU,DC=our,DC=domain,DC=com' domain: our.domain.com rights: definedright1: 'Our Users'
The error message is:
Can't call method "groups" on unblessed reference at /home/camel/perl5 +/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/Dancer2/Plugin/Auth/ +ActiveDirectory.pm line 140. /home/camel/perl5/perlbrew/perls/perl-5.30.1/lib/site_perl/5.30.1/Danc +er2/Plugin/Auth/ActiveDirectory.pm around line 140 135 136 register authenticate => sub { 137 my ( $dsl, $name, $pass ) = @_; 138 my $user = _connect_to_ad($dsl)->authenticate( $name, $pass + ); 139 return $user if $user->{error}; 140 my $user_groups = [ map { $_->name } @{ $user->groups } ]; 141 return { 142 uid => $user->uid, 143 firstname => $user->firstname, 144 surname => $user->surname, 145 mail => $user->mail,
I've tried two different AD accounts, both of which are members of the "Our Users" group, and get the same error message. If I put in an invalid password I get a different error. As far as I can tell I am following all of the directions in the documentation, and I'm using the same AD settings that are currently working in the PHP webapp that I'm attempting to rewrite in Perl. Any insights will be greatly appreciated.

In reply to Error with Dancer2::Plugin::Auth::ActiveDirectory by TieUpYourCamel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.