1
# -*- Mode: perl; indent-tabs-mode: nil -*-
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/
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.
13
# The Original Code is the Bugzilla Bug Tracking System.
15
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
17
package Bugzilla::Auth::Login;
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;
33
my $self = fields::new($class);
43
Bugzilla::Auth::Login - Gets username/password data from the user.
47
Bugzilla::Auth::Login is used to get information that uniquely identifies
48
a user and allows us to authorize their Bugzilla access.
50
It is mostly an abstract class, requiring subclasses to implement
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.
59
These are methods that have to do with getting the actual login data
60
from the user or handling a login somehow.
62
These methods are abstract -- they MUST be implemented by a subclass.
66
=item C<get_login_info()>
68
Description: Gets a username/password from the user, or some other
69
information that uniquely identifies them.
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>.
77
=item C<fail_nodata()>
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.
84
This function MUST stop CGI execution when it is complete.
85
That is, it must call C<exit> or C<ThrowUserError> or some
88
Returns: Never Returns.
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>.
102
Whether or not users can log out if they logged in using this
103
object. Defaults to C<true>.
107
Whether or not users can log in through the web interface using
108
this object. Defaults to C<true>.
110
=item C<requires_persistence>
112
Whether or not we should send the user a cookie if they logged in with
113
this method. Defaults to C<true>.
115
=item C<requires_verification>
117
Whether or not we should check the username/password that we
118
got from this login method. Defaults to C<true>.
120
=item C<user_can_create_account>
122
Whether or not users can create accounts, if this login method is
123
currently being used by the system. Defaults to C<false>.