line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PlugAuth::Client::Tiny::Apache2AuthzHandler; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1607
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
5
|
2
|
|
|
2
|
|
46
|
use 5.012; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
780
|
use PlugAuth::Client::Tiny; |
|
2
|
|
|
|
|
54716
|
|
|
2
|
|
|
|
|
60
|
|
7
|
2
|
|
|
2
|
|
376
|
use Apache2::Access (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
8
|
1
|
|
|
1
|
|
4
|
use Apache2::RequestRec (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
9
|
1
|
|
|
1
|
|
5
|
use Apache2::RequestUtil (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
10
|
1
|
|
|
1
|
|
5
|
use Apache2::Const -compile => qw(OK HTTP_UNAUTHORIZED); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
162
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Apache authorization handler for PlugAuth |
13
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub handler |
17
|
|
|
|
|
|
|
{ |
18
|
3
|
|
|
3
|
0
|
5992
|
my($r) = @_; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
16
|
my $auth = PlugAuth::Client::Tiny->new(url => $ENV{PLUGAUTH_URL}); |
21
|
3
|
|
100
|
|
|
28
|
my $prefix = $ENV{PLUGAUTH_PREFIX} // ''; |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
8
|
my $user = $r->user; |
24
|
3
|
100
|
66
|
|
|
25
|
if($user && $auth->authz($user, $r->method, $prefix . $r->uri)) |
25
|
|
|
|
|
|
|
{ |
26
|
2
|
|
|
|
|
31
|
return Apache2::Const::OK; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else |
29
|
|
|
|
|
|
|
{ |
30
|
1
|
|
|
|
|
18
|
$r->note_basic_auth_failure; |
31
|
1
|
|
|
|
|
8
|
return Apache2::Const::HTTP_UNAUTHORIZED; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |