blib/lib/CGI/Application/Plugin/Authentication/Driver/Authen/Simple.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 80.0% 36 / 45 CC 6 SCAR 15.2
CC
6
Cov
81%
verify_credentials
7.5
BEGIN
1.0
BEGIN
1.0
CRAP 4.6
« blib/lib/CGI/Application/Plugin/Authentication/Driver/Filter/sha1.pm ↑ Summary blib/lib/CGI/Application/Plugin/Authentication/Driver.pm »
1 package CGI::Application::Plugin::Authentication::Driver::Authen::Simple;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base qw(CGI::Application::Plugin::Authentication::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use UNIVERSAL::require;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 CGI::Application::Plugin::Authentication::Driver::Authen::Simple - Authen::Simple Authentication driver
14  
15  
16 =head1 SYNOPSIS
17  
18 use base qw(CGI::Application);
19 use CGI::Application::Plugin::Authentication;
20  
21 __PACKAGE__->authen->config(
22 DRIVER => [ 'Authen::Simple::Kerberos', realm => 'REALM.COMPANY.COM' ],
23 );
24  
25 =head1 DESCRIPTION
26  
27 This driver allows you to use any modules that following the Authen::Simple
28 API. All options that you provide will be passed on to the given Authen::Simple
29 module.
30  
31 =head1 EXAMPLE
32  
33 __PACKAGE__->authen->config(
34 DRIVER => [ 'Authen::Simple::CDBI', class => 'MyApp::Model::User' ],
35 );
36  
37  
38 =head1 METHODS
39  
40 =head2 verify_credentials
41  
42 This method will test the provided credentials against the Authen::Simple module
43 that was configured.
44  
45 =cut
46  
47 sub verify_credentials {
48 2 ▶ my $self = shift;
Subroutine verify_credentials: called CC=6 SCAR=20.2
Pod documented
49 2 my @creds = @_;
50 2 my @options = $self->options;
51 2 my $authen_class = shift @options;
52  
53 2 ▶ return undef unless defined $creds[0] && defined $creds[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $creds[0] and defined $creds[1] 0 2 2
Condition33%1/3
defined $creds[0] and defined $creds[1]
!ll&&!rl&&r
002
MC/DC0%0/2
defined $creds[0] and defined $creds[1]
defined $creds[0] defined $creds[1]
Truth table33%1/3
A and B
A= defined $creds[0]B= defined $creds[1]
ABresult
0X0
100
111
54  
55 2 ▶ $authen_class->require || Carp::croak("The $authen_class module is not installed");
Branch: 1 branch
BranchTrueFalseTotal
$authen_class->require or Carp::croak("The $authen_class module is not installed") 1 1 2
56  
57 1 my $authen_obj = $authen_class->new(@options);
58 1 ▶ croak("Failed to create $authen_class instance") if !defined $authen_obj;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $authen_obj 1 0 1
59  
60 0 ▶ return $authen_obj->authenticate(@creds) ? $creds[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$authen_obj->authenticate(@creds) ? : 0 0 0
61 }
62  
63  
64 =head1 SEE ALSO
65  
66 L<CGI::Application::Plugin::Authentication::Driver>, L<CGI::Application::Plugin::Authentication>, perl(1)
67  
68  
69 =head1 LICENCE AND COPYRIGHT
70  
71 Copyright (c) 2006, SiteSuite. All rights reserved.
72  
73 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
74  
75  
76 =head1 DISCLAIMER OF WARRANTY
77  
78 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
79  
80 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
81  
82 =cut
83  
84 3 1;
« blib/lib/CGI/Application/Plugin/Authentication/Driver/Filter/sha1.pm ↑ Summary blib/lib/CGI/Application/Plugin/Authentication/Driver.pm »