Authentication/Driver/Authen/Simple.pm

filter: Statementstmt 96.1% 25 / 26 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.4% 37 / 46 SCAR 18.3
CC
6
Cov
81%
verify_credentials
7.5
BEGIN
1.0
BEGIN
1.0
CRAP 6.2
« Authentication/Display/Basic.pm ↑ Summary Authentication/Display.pm »
1 package CGI::Application::Plugin::Authentication::Driver::Authen::Simple;
2 2 $CGI::Application::Plugin::Authentication::Driver::Authen::Simple::VERSION = '0.21';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base qw(CGI::Application::Plugin::Authentication::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶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 =head1 SYNOPSIS
16  
17 use base qw(CGI::Application);
18 use CGI::Application::Plugin::Authentication;
19  
20 __PACKAGE__->authen->config(
21 DRIVER => [ 'Authen::Simple::Kerberos', realm => 'REALM.COMPANY.COM' ],
22 );
23  
24 =head1 DESCRIPTION
25  
26 This driver allows you to use any modules that following the Authen::Simple
27 API. All options that you provide will be passed on to the given Authen::Simple
28 module.
29  
30 =head1 EXAMPLE
31  
32 __PACKAGE__->authen->config(
33 DRIVER => [ 'Authen::Simple::CDBI', class => 'MyApp::Model::User' ],
34 );
35  
36  
37 =head1 METHODS
38  
39 =head2 verify_credentials
40  
41 This method will test the provided credentials against the Authen::Simple module
42 that was configured.
43  
44 =cut
45  
46 sub verify_credentials {
47 2 ▶ my $self = shift;
Subroutine verify_credentials: called CC=6 SCAR=20.2
Pod documented
48 2 my @creds = @_;
49 2 my @options = $self->options;
50 2 my $authen_class = shift @options;
51  
52 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
53  
54 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
55  
56 1 my $authen_obj = $authen_class->new(@options);
57 1 ▶ croak("Failed to create $authen_class instance") if !defined $authen_obj;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $authen_obj 1 0 1
58  
59 0 ▶ return $authen_obj->authenticate(@creds) ? $creds[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$authen_obj->authenticate(@creds) ? : 0 0 0
60 }
61  
62  
63 =head1 SEE ALSO
64  
65 L<CGI::Application::Plugin::Authentication::Driver>, L<CGI::Application::Plugin::Authentication>, perl(1)
66  
67  
68 =head1 LICENCE AND COPYRIGHT
69  
70 Copyright (c) 2006, SiteSuite. All rights reserved.
71  
72 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
73  
74  
75 =head1 DISCLAIMER OF WARRANTY
76  
77 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.
78  
79 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.
80  
81 =cut
82  
83 2 1;
« Authentication/Display/Basic.pm ↑ Summary Authentication/Display.pm »