~ubuntu-branches/debian/sid/bugzilla/sid

« back to all changes in this revision

Viewing changes to Bugzilla/Auth/Login.pm

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Bossek
  • Date: 2008-06-27 22:34:34 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080627223434-0ib57vstn43bb4a3
Tags: 3.0.4.1-1
* Update of French, Russian and German translations. (closes: #488251)
* Added Bulgarian and Belarusian translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- Mode: perl; indent-tabs-mode: nil -*-
2
 
#
3
 
# The contents of this file are subject to the Mozilla Public
4
 
# License Version 1.1 (the "License"); you may not use this file
5
 
# except in compliance with the License. You may obtain a copy of
6
 
# the License at http://www.mozilla.org/MPL/
7
 
#
8
 
# Software distributed under the License is distributed on an "AS
9
 
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
 
# implied. See the License for the specific language governing
11
 
# rights and limitations under the License.
12
 
#
13
 
# The Original Code is the Bugzilla Bug Tracking System.
14
 
#
15
 
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
16
 
 
17
 
package Bugzilla::Auth::Login;
18
 
 
19
 
use strict;
20
 
use fields qw();
21
 
 
22
 
# Determines whether or not a user can logout. It's really a subroutine,
23
 
# but we implement it here as a constant. Override it in subclasses if
24
 
# that particular type of login method cannot log out.
25
 
use constant can_logout => 1;
26
 
use constant can_login  => 1;
27
 
use constant requires_persistence  => 1;
28
 
use constant requires_verification => 1;
29
 
use constant user_can_create_account => 0;
30
 
 
31
 
sub new {
32
 
    my ($class) = @_;
33
 
    my $self = fields::new($class);
34
 
    return $self;
35
 
}
36
 
 
37
 
1;
38
 
 
39
 
__END__
40
 
 
41
 
=head1 NAME
42
 
 
43
 
Bugzilla::Auth::Login - Gets username/password data from the user.
44
 
 
45
 
=head1 DESCRIPTION
46
 
 
47
 
Bugzilla::Auth::Login is used to get information that uniquely identifies
48
 
a user and allows us to authorize their Bugzilla access.
49
 
 
50
 
It is mostly an abstract class, requiring subclasses to implement
51
 
most methods.
52
 
 
53
 
Note that callers outside of the C<Bugzilla::Auth> package should never
54
 
create this object directly. Just create a C<Bugzilla::Auth> object
55
 
and call C<login> on it.
56
 
 
57
 
=head1 LOGIN METHODS
58
 
 
59
 
These are methods that have to do with getting the actual login data
60
 
from the user or handling a login somehow.
61
 
 
62
 
These methods are abstract -- they MUST be implemented by a subclass.
63
 
 
64
 
=over 4
65
 
 
66
 
=item C<get_login_info()>
67
 
 
68
 
Description: Gets a username/password from the user, or some other
69
 
             information that uniquely identifies them.
70
 
Params:      None
71
 
Returns:     A C<$login_data> hashref. (See L<Bugzilla::Auth> for details.)
72
 
             The hashref MUST contain: C<user_id> *or* C<username>
73
 
             If this is a login method that requires verification,
74
 
             the hashref MUST contain C<password>.
75
 
             The hashref MAY contain C<realname> and C<extern_id>.
76
 
 
77
 
=item C<fail_nodata()>
78
 
 
79
 
Description: This function is called when Bugzilla doesn't get
80
 
             a username/password and the login type is C<LOGIN_REQUIRED>
81
 
             (See L<Bugzilla::Auth> for a description of C<LOGIN_REQUIRED>).
82
 
             That is, this handles C<AUTH_NODATA> in that situation.
83
 
 
84
 
             This function MUST stop CGI execution when it is complete.
85
 
             That is, it must call C<exit> or C<ThrowUserError> or some
86
 
             such thing.
87
 
Params:      None
88
 
Returns:     Never Returns.
89
 
 
90
 
=back
91
 
 
92
 
=head1 INFO METHODS
93
 
 
94
 
These are methods that describe the capabilities of this 
95
 
C<Bugzilla::Auth::Login> object. These are all no-parameter
96
 
methods that return either C<true> or C<false>.
97
 
 
98
 
=over 4
99
 
 
100
 
=item C<can_logout>
101
 
 
102
 
Whether or not users can log out if they logged in using this
103
 
object. Defaults to C<true>.
104
 
 
105
 
=item C<can_login>
106
 
 
107
 
Whether or not users can log in through the web interface using
108
 
this object. Defaults to C<true>.
109
 
 
110
 
=item C<requires_persistence>
111
 
 
112
 
Whether or not we should send the user a cookie if they logged in with
113
 
this method. Defaults to C<true>.
114
 
 
115
 
=item C<requires_verification>
116
 
 
117
 
Whether or not we should check the username/password that we
118
 
got from this login method. Defaults to C<true>.
119
 
 
120
 
=item C<user_can_create_account>
121
 
 
122
 
Whether or not users can create accounts, if this login method is
123
 
currently being used by the system. Defaults to C<false>.
124
 
 
125
 
=back