File Coverage

blib/lib/Authen/PAAS/Principal.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::Principal 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: Principal.pm,v 1.1 2005/08/21 07:39:38 dan Exp $
22              
23             =pod
24              
25             =head1 NAME
26              
27             Authen::PAAS::Principal - An identity for a subject
28              
29             =head1 SYNOPSIS
30              
31             use Authen::PAAS::Principal;
32              
33             my $princ = Authen::PAAS::Principal->new(name => $name);
34              
35             print $princ->name, "\n";
36              
37             =head1 DESCRIPTION
38              
39             This module represents an identity for a subject. An identity
40             may be a kerberos principal, a UNIX username, or any other
41             identifying token related to a particular authentication
42             scheme. This module will usually be sub-classed by each
43             C implementation to provide module
44             specific identifying data.
45              
46             =head1 METHODS
47              
48             =over 4
49              
50             =cut
51              
52             package Authen::PAAS::Principal;
53              
54 3     3   40369 use warnings;
  3         8  
  3         118  
55 3     3   17 use strict;
  3         4  
  3         518  
56              
57             our $VERSION = '1.0.0';
58              
59             =item $obj = Authen::PAAS::Principal->new(name => $name);
60              
61             Create a new principal with a name given by the C
62             parameter. This constructor will typically only be used
63             by sub-classes of this module.
64              
65             =cut
66              
67             sub new {
68 8     8 1 1799 my $proto = shift;
69 8   33     49 my $class = ref($proto) || $proto;
70 8         14 my $self = {};
71 8         26 my %params = @_;
72              
73 8 50       72 $self->{name} = exists $params{name} ? $params{name} : die "name parameter is required";
74              
75 8         17 bless $self, $class;
76              
77 8         27 return $self;
78             }
79              
80              
81             =item my $name = $princ->name;
82              
83             Retrieves the name associated with this principal, as set
84             in the constructor.
85              
86             =cut
87              
88             sub name {
89 1     1 1 831 my $self = shift;
90 1         11 return $self->{name};
91             }
92              
93              
94             1 # So that the require or use succeeds.
95              
96             __END__