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
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
15
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
16
|
|
|
|
|
|
|
our $VERSION = "1.0_1"; |
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
|
|
4
|
use Authen::Credential qw(); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
30
|
1
|
|
|
1
|
|
742
|
use MIME::Base64 qw(encode_base64); |
|
1
|
|
|
|
|
719
|
|
|
1
|
|
|
|
|
72
|
|
31
|
1
|
|
|
1
|
|
6
|
use Params::Validate qw(validate_pos :types); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
237
|
|
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
|
|
4
|
no strict "refs"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
150
|
|
48
|
|
|
|
|
|
|
*{ $name } = sub { |
49
|
4
|
|
|
4
|
|
32
|
my($self); |
50
|
4
|
|
|
|
|
7
|
$self = shift(@_); |
51
|
4
|
50
|
|
|
|
10
|
validate_pos(@_) if @_; |
52
|
4
|
|
|
|
|
32
|
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__ |