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
# The Initial Developer of the Original Code is Netscape Communications
16
# Corporation. Portions created by Netscape are
17
# Copyright (C) 1998 Netscape Communications Corporation. All
20
# Contributor(s): Erik Stambaugh <erik@dasbistro.com>
22
package Bugzilla::Auth::Login::WWW;
26
use Bugzilla::Constants;
29
# $current_login_class stores the name of the login style that succeeded.
30
my $current_login_class = undef;
32
my ($class, $type) = @_;
34
$current_login_class = $type;
36
return $current_login_class;
39
# can_logout determines if a user may log out
41
return 1 if (login_class && login_class->can_logout);
46
my ($class, $type) = @_;
48
my $user = Bugzilla->user;
50
# Avoid double-logins, which may confuse the auth code
51
# (double cookies, odd compat code settings, etc)
52
return $user if $user->id;
54
$type = LOGIN_REQUIRED if Bugzilla->cgi->param('GoAheadAndLogIn');
55
$type = LOGIN_NORMAL unless defined $type;
57
# Log in using whatever methods are defined in user_info_class.
58
# Please note the particularly strange way require() and the function
59
# calls are being done, because we're calling a module that's named in
60
# a string. I assure you it works, and it avoids the need for an eval().
62
for my $login_class (split(/,\s*/, Param('user_info_class'))) {
63
require "Bugzilla/Auth/Login/WWW/" . $login_class . ".pm";
64
$userid = "Bugzilla::Auth::Login::WWW::$login_class"->login($type);
66
$class->login_class("Bugzilla::Auth::Login::WWW::$login_class");
72
$user = new Bugzilla::User($userid);
74
# Redirect to SSL if required
75
if (Param('sslbase') ne '' and Param('ssl') ne 'never') {
76
Bugzilla->cgi->require_https(Param('sslbase'));
78
$user->set_flags('can_logout' => $class->can_logout);
80
Bugzilla->logout_request();
86
my ($class, $user, $option) = @_;
88
$class->login_class->logout($user, $option);
99
Bugzilla::Auth::Login::WWW - WWW login information gathering module
107
Passes C<login> calls to each class defined in the param C<user_info_class>
108
and returns a C<Bugzilla::User> object from the first one that successfully
109
gathers user login information.