oetiker / mojolicious-plugin-spnego Goto Github PK
View Code? Open in Web Editor NEWProvide SPNEGO NTLM authentication to Mojolicious applications
License: Other
Provide SPNEGO NTLM authentication to Mojolicious applications
License: Other
How to configure things when AD servers are updated with the GPO policy "Require NTLMv2 session security, Require 128-bit encryption". This was done recently and the plugin stopped working. I tried to enable TLS and this stops the error which mentions this particular change but doesn't work and I suspect that something need to be done to address this server change?
In a full Mojo App, the example code works well if copied it inside each controller. However, I can't figure out how to call it during application startup
. For example, in my startup
:
my $r = $self->routes;
$r->get ('/')->to('NP#index');
my $auth = $r->under('/' => sub ($c) {
# Authenticated
return 1 if $self->session('user');
# NTLM Auth
$c->ntlm_auth({
auth_success_cb => sub {
my $c = shift;
my $user = shift;
my $ldap = shift; # bound Net::LDAP::SPNEGO connection
$c->session('user',$user->{samaccountname});
$c->session('name',$user->{displayname});
my $groups = $ldap->get_ad_groups($user->{samaccountname});
$c->session('groups',[ sort keys %$groups]);
return 1;
}
});
# Not authenticated
$c->render(text => "You're not Authenticated", status => 401);
return undef;
});
$auth->post('/')->to('NP#search');
When I perform POST
, no authentication occurs and I get the following errors:
Mojo::Reactor::Poll: I/O watcher failed: A response has already been rendered at /Users/hq/perl5/lib/perl5/Mojolicious/Controller.pm line 154.
[2023-04-12 13:22:21.71712] [84671] [trace] Inactivity timeout
If I comment-out the $c->render
line, authentication occurs, but I get:
Nothing has been rendered, expecting delayed response
and no results are rendered.
Would you kindly point me to where I've gone wrong?
Thank you!
running the example from the Synopsis gives:
[Tue Oct 18 13:28:16 2016] [error] Can't use string ("1/8") as a HASH ref while "strict refs" in use at C:/Progs/Perl5222/perl/site/lib/Mojolicious/Plugin/SPNEG O.pm line 22, <DATA> line 755.
This is due to line 17:
my $helper_cfg = ref ${_}[0] ? %{${_}[0]} : { @_ };
witch should be
my $helper_cfg = ref ${_}[0] ? ${_}[0] : { @_ };
Sample fail report: http://www.cpantesters.org/cpan/report/3fb75762-67d2-11e6-bf95-9af3a1116530
0.2.3 fails in the same way, but CPAN Testers reports are not yet delivered.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.