File Coverage

blib/lib/Authen/Simple/PlugAuth.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 28 28 100.0


line stmt bran cond sub pod time code
1             package Authen::Simple::PlugAuth;
2              
3 2     2   1482 use strict;
  2         4  
  2         68  
4 2     2   13 use warnings;
  2         3  
  2         73  
5 2     2   18 use base 'Authen::Simple::Adapter';
  2         4  
  2         2789  
6 2     2   95690 use PlugAuth::Client::Tiny;
  2         1012793  
  2         478  
7              
8             # ABSTRACT: Simple PlugAuth authentication
9             our $VERSION = '0.01'; # VERSION
10              
11              
12             __PACKAGE__->options({
13             url => {
14             type => Params::Validate::SCALAR,
15             optional => 0,
16             },
17             });
18              
19              
20              
21             sub init
22             {
23 1     1 1 101 my($self, $param) = @_;
24 1         8 $self->SUPER::init($param);
25 1         38 $self->{client} = PlugAuth::Client::Tiny->new( url => $self->url );
26 1         23 $self;
27             }
28              
29             sub check
30             {
31 2     2 1 2423 my($self, $username, $password) = @_;
32 2 100       7 $self->{client}->auth($username, $password) ? 1 : 0;
33             }
34              
35             1;
36              
37             __END__