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