line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PlugAuth::Client::Tiny::Apache2AuthenHandler; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1645
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
5
|
2
|
|
|
2
|
|
53
|
use 5.012; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
740
|
use PlugAuth::Client::Tiny; |
|
2
|
|
|
|
|
54674
|
|
|
2
|
|
|
|
|
118
|
|
7
|
2
|
|
|
2
|
|
752
|
use Apache2::RequestRec (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Apache2::Access (); |
9
|
|
|
|
|
|
|
use Apache2::RequestUtil (); |
10
|
|
|
|
|
|
|
use Apache2::Const -compile => qw( OK HTTP_UNAUTHORIZED ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Apache authentication handler for PlugAuth |
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub handler |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
my($r) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my($status, $password) = $r->get_basic_auth_pw; |
21
|
|
|
|
|
|
|
return $status unless $status == Apache2::Const::OK; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $auth = PlugAuth::Client::Tiny->new(url => $ENV{PLUGAUTH_URL}); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
if($auth->auth($r->user, $password)) |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
return Apache2::Const::OK; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
$r->note_basic_auth_failure; |
32
|
|
|
|
|
|
|
return Apache2::Const::HTTP_UNAUTHORIZED; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |