File Coverage

blib/lib/Authen/PAAS/Credential.pm
Criterion Covered Total %
statement 15 15 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 4 4 100.0
pod 2 2 100.0
total 23 26 88.4


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             #
3             # Authen::PAAS::Credential 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: Credential.pm,v 1.2 2004/12/28 23:43:46 dan Exp $
22              
23             =pod
24              
25             =head1 NAME
26              
27             Authen::PAAS::Credential - represents a credential for a subject
28              
29             =head1 SYNOPSIS
30              
31             use Authen::PAAS::Credential;
32              
33             my $cred = Authen::PAAS::Credential->new(name => "krb5ticket");
34              
35             print $cred->name, "\n";
36              
37             =head1 DESCRIPTION
38              
39             The C module represents a credential for
40             an authenticated subject. A credential is merely an abstract token
41             generated during the authentication process. This module would be
42             subclassed by C implementations to provide
43             module specific data.
44              
45             =head1 METHODS
46              
47             =over 4
48              
49             =cut
50              
51             package Authen::PAAS::Credential;
52              
53 2     2   24042 use warnings;
  2         4  
  2         52  
54 2     2   10 use strict;
  2         3  
  2         305  
55              
56             our $VERSION = '1.0.0';
57              
58              
59             =item $cred = Authen::PAAS::Credential->new(name => $name);
60              
61             Create a new credential assigning it the name given by the
62             C parameter to the method. This constructor is usually
63             only used by sub-classes.
64              
65             =cut
66              
67             sub new {
68 5     5 1 535 my $proto = shift;
69 5   33     28 my $class = ref($proto) || $proto;
70 5         8 my $self = {};
71 5         16 my %params = @_;
72              
73 5 50       22 $self->{name} = exists $params{name} ? $params{name} : die "name parameter is required";
74              
75 5         11 bless $self, $class;
76              
77 5         14 return $self;
78             }
79              
80              
81             =item $name = $cred->name;
82              
83             Retrieves the name of this credential.
84              
85             =cut
86              
87             sub name {
88 1     1 1 760 my $self = shift;
89 1         10 return $self->{name};
90             }
91              
92             1 # So that the require or use succeeds.
93              
94             __END__