| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#+############################################################################## |
|
2
|
|
|
|
|
|
|
# # |
|
3
|
|
|
|
|
|
|
# File: Authen/Credential/plain.pm # |
|
4
|
|
|
|
|
|
|
# # |
|
5
|
|
|
|
|
|
|
# Description: abstraction of a "plain" credential # |
|
6
|
|
|
|
|
|
|
# # |
|
7
|
|
|
|
|
|
|
#-############################################################################## |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# module definition |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Authen::Credential::plain; |
|
14
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
33
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
98
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = "1.2"; |
|
17
|
|
|
|
|
|
|
our $REVISION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# inheritance |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @ISA = qw(Authen::Credential); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# used modules |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
8
|
use Authen::Credential qw(); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
30
|
1
|
|
|
1
|
|
491
|
use MIME::Base64 qw(encode_base64); |
|
|
1
|
|
|
|
|
2627
|
|
|
|
1
|
|
|
|
|
72
|
|
|
31
|
1
|
|
|
1
|
|
8
|
use Params::Validate qw(validate_pos :types); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
224
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# |
|
34
|
|
|
|
|
|
|
# Params::Validate specification |
|
35
|
|
|
|
|
|
|
# |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$Authen::Credential::ValidationSpec{plain} = { |
|
38
|
|
|
|
|
|
|
name => { type => SCALAR }, |
|
39
|
|
|
|
|
|
|
pass => { type => SCALAR }, |
|
40
|
|
|
|
|
|
|
}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# accessors |
|
44
|
|
|
|
|
|
|
# |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
foreach my $name (qw(name pass)) { |
|
47
|
1
|
|
|
1
|
|
7
|
no strict "refs"; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
216
|
|
|
48
|
|
|
|
|
|
|
*{ $name } = sub { |
|
49
|
4
|
|
|
4
|
|
32
|
my($self); |
|
50
|
4
|
|
|
|
|
8
|
$self = shift(@_); |
|
51
|
4
|
50
|
|
|
|
11
|
validate_pos(@_) if @_; |
|
52
|
4
|
|
|
|
|
76
|
return($self->{$name}); |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# |
|
57
|
|
|
|
|
|
|
# preparators |
|
58
|
|
|
|
|
|
|
# |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$Authen::Credential::Preparator{plain}{"HTTP.Basic"} = sub { |
|
61
|
|
|
|
|
|
|
my($self); |
|
62
|
|
|
|
|
|
|
$self = shift(@_); |
|
63
|
|
|
|
|
|
|
validate_pos(@_) if @_; |
|
64
|
|
|
|
|
|
|
return("Basic " . encode_base64($self->name() . ":" . $self->pass(), "")); |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__DATA__ |