File Coverage

blib/lib/Authen/PAAS/Callback.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition 1 3 33.3
subroutine 3 4 75.0
pod 2 2 100.0
total 18 23 78.2


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             #
3             # Authen::PAAS::Callback by Daniel Berrange
4             #
5             # Copyright (C) 2004-2006 Dan Berrange
6             #
7             # This program is free software; you can redistribute it and/or modify
8             # it under the terms of the GNU General Public License as published by
9             # the Free Software Foundation; either version 2 of the License, or
10             # (at your option) any later version.
11             #
12             # This program is distributed in the hope that it will be useful,
13             # but WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             # GNU General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License
18             # along with this program; if not, write to the Free Software
19             # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20             #
21             # $Id: Callback.pm,v 1.2 2005/08/21 07:39:37 dan Exp $
22              
23             =pod
24              
25             =head1 NAME
26              
27             Authen::PAAS::Callback - callback for retrieving authentication data
28              
29             =head1 SYNOPSIS
30              
31             use Authen::PAAS::Callback;
32              
33             my $callback = Authen::PAAS::Callback::SOMECLASS->new();
34             my $data = $callback->data;
35              
36             =head1 DESCRIPTION
37              
38             This module provides an mechanism for login modules to retrieve
39             authentication data from an external party, without having to
40             know the means of communication between the application and the
41             user. So, a login module can merely lookup the callback associated
42             with the key C, and ask it for data, regardless of whether
43             the callback reads the username from the console, pops up a dialog
44             box, or fetches it from the HTTP headers.
45              
46             =head1 METHODS
47              
48             =over 4
49              
50             =cut
51              
52             package Authen::PAAS::Callback;
53              
54 3     3   29346 use strict;
  3         6  
  3         116  
55 3     3   15 use warnings;
  3         6  
  3         506  
56              
57             our $VERSION = '1.0.0';
58              
59             =item my $callback = Authen::PAAS::Callback->new();
60              
61             Creates a new callback object. There are no required parameters
62             to this constructor.
63              
64             =cut
65              
66             sub new {
67 8     8 1 29 my $proto = shift;
68 8   33     45 my $class = ref($proto) || $proto;
69 8         18 my $self = {};
70 8         18 my %params = @_;
71              
72 8         21 bless $self, $class;
73              
74 8         26 return $self;
75             }
76              
77              
78             =item my $data = $callback->data;
79              
80             Retrieves the data from this callback. This method must be
81             implemented by the subclass, and it is entirely upto the
82             subclass how the data is collected from the user.
83              
84             =cut
85              
86             sub data {
87 0     0 1   my $self = shift;
88 0           die "object " . ref($self) . " forgot to implement the data method";
89             }
90              
91             1 # So that the require or use succeeds.
92              
93             __END__