Explorar o código

Fix issues with default auth route, now to test new

Andy Baugh %!s(int64=3) %!d(string=hai) anos
pai
achega
467fe52eb1
Modificáronse 4 ficheiros con 5 adicións e 4 borrados
  1. 1 0
      lib/Trog/Authz.pm
  2. 2 2
      lib/Trog/Authz/Base.pm
  3. 1 1
      lib/Trog/Authz/Default.pm
  4. 1 1
      lib/Trog/Authz/Matrix.pm

+ 1 - 0
lib/Trog/Authz.pm

@@ -12,6 +12,7 @@ sub do_auth_for ($module, $params) {
     die "Invalid authorization class" if !grep { $module eq $_ } @{__PACKAGE__->valid_modules()};
     my $class = "Trog::Authz::$module";
     eval "require $class";
+    die $@ if $@;
     return $class->new($params);
 }
 

+ 2 - 2
lib/Trog/Authz/Base.pm

@@ -1,4 +1,4 @@
-package Trog::Authz;
+package Trog::Authz::Base;
 
 use strict;
 use warnings;
@@ -18,7 +18,7 @@ sub do_auth {
     die "Implemented in subclass";
 }
 
-sub failed ($self, $failed) {
+sub failed ($self, $failed = $self->{'failed'} ) {
     $self->{'failed'} = $failed if defined($failed);
     $self->{'failed'} //= -1;
     return $self->{'failed'};

+ 1 - 1
lib/Trog/Authz/Default.pm

@@ -6,7 +6,7 @@ use warnings;
 no warnings 'experimental';
 use feature qw{signatures state};
 
-use parent Trog::Authz::Base;
+use parent 'Trog::Authz::Base';
 
 use File::Touch ();
 use Trog::Auth  ();

+ 1 - 1
lib/Trog/Authz/Matrix.pm

@@ -6,7 +6,7 @@ use warnings;
 no warnings 'experimental';
 use feature qw{signatures state};
 
-use parent Trog::Authz::Base;
+use parent 'Trog::Authz::Base';
 
 use Trog::Auth ();
 use HTTP::Tiny ();