File Coverage

blib/lib/Auth/Kokolores/Request.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Auth::Kokolores::Request;
2              
3 4     4   67965 use Moose;
  4         935542  
  4         21  
4              
5             # ABSTRACT: saslauthd protocol request object
6             our $VERSION = '1.01'; # VERSION
7              
8              
9 4     4   17514 use Digest::MD5 qw(md5_base64);
  4         4  
  4         726  
10              
11             has 'username' => ( is => 'rw', isa => 'Str', required => 1 );
12             has 'password' => ( is => 'rw', isa => 'Str', required => 1 );
13              
14             has 'fingerprint' => (
15             is => 'ro', isa => 'Str', lazy => 1,
16             default => sub {
17             my $self = shift;
18             return md5_base64( $self->username.':'.$self->password );
19             },
20             );
21              
22             has 'parameters' => (
23             is => 'ro', isa => 'HashRef',
24             default => sub { {} },
25             traits => [ 'Hash' ],
26             handles => {
27             set_param => 'set',
28             get_param => 'get',
29             },
30             );
31              
32              
33             has 'server' => (
34             is => 'ro',
35             isa => 'Net::Server',
36             required => 1,
37             handles => {
38             log => 'log',
39             },
40             );
41              
42              
43             has 'userinfo' => (
44             is => 'ro', isa => 'HashRef', lazy => 1,
45             default => sub { {} },
46             traits => [ 'Hash' ],
47             handles => {
48             get_info => 'get',
49             set_info => 'set',
50             },
51             );
52              
53              
54             1;
55              
56             __END__
57              
58             =pod
59              
60             =encoding UTF-8
61              
62             =head1 NAME
63              
64             Auth::Kokolores::Request - saslauthd protocol request object
65              
66             =head1 VERSION
67              
68             version 1.01
69              
70             =head1 DESCRIPTION
71              
72             This class holds all information associated with an authentication request.
73             It is passed to all authentication plugins.
74              
75             =head1 ATTRIBUTES
76              
77             =head2 username
78              
79             The username passed within the request.
80              
81             =head2 password
82              
83             The password passed within the request.
84              
85             =head2 parameters
86              
87             Additional request parameters.
88              
89             Other than the required parameters username and password.
90              
91             =head2 fingerprint
92              
93             A fingerprint for the authentication based on username + password.
94              
95             =head2 server
96              
97             A reference to the L<Auth::Kokolores> server object.
98              
99             =head2 userinfo
100              
101             A hashref holding additional information to be passed between plugins.
102              
103             Use get_info and set_info methods to access fields.
104              
105             =head1 METHODS
106              
107             =head2 get_param( $key )
108              
109             Retrieve field $key from parameters.
110              
111             =head2 set_param( $key, $value )
112              
113             Set field $key to $value in parameters.
114              
115             =head2 get_info( $key )
116              
117             Retrieve field $key from userinfo.
118              
119             =head2 set_info( $key, $value )
120              
121             Set field $key to $value in userinfo.
122              
123             =head1 AUTHOR
124              
125             Markus Benning <ich@markusbenning.de>
126              
127             =head1 COPYRIGHT AND LICENSE
128              
129             This software is Copyright (c) 2016 by Markus Benning <ich@markusbenning.de>.
130              
131             This is free software, licensed under:
132              
133             The GNU General Public License, Version 2, June 1991
134              
135             =cut