summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Auth.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-09-01 07:01:20 +0200
committerByron Jones <glob@mozilla.com>2015-09-01 07:01:20 +0200
commit421ff7f194875db9634ea783d9dd5b6111f19df3 (patch)
tree5806e9f3001fa4f33ba85aa94856b70a7f878cf8 /Bugzilla/Auth.pm
parentbcc93f83a64a76cd73501eaefaf5fd073fbc3f0d (diff)
downloadbugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.gz
bugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.xz
Bug 1197073 - add support for 2fa using totp (eg. google authenticator)
Diffstat (limited to 'Bugzilla/Auth.pm')
-rw-r--r--Bugzilla/Auth.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm
index 88eadbe19..a4f2dd9a9 100644
--- a/Bugzilla/Auth.pm
+++ b/Bugzilla/Auth.pm
@@ -33,7 +33,7 @@ use fields qw(
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Mailer;
-use Bugzilla::Util qw(datetime_from);
+use Bugzilla::Util qw(datetime_from i_am_webservice);
use Bugzilla::User::Setting ();
use Bugzilla::Auth::Login::Stack;
use Bugzilla::Auth::Verify::Stack;
@@ -93,9 +93,28 @@ sub login {
}
$user->set_authorizer($self);
+ # trigger multi-factor auth. once verified the provider calls mfa_verified()
+ if ($self->{_info_getter}->{successful}->requires_verification
+ && $user->mfa
+ && !Bugzilla->sudoer
+ && !i_am_webservice()
+ ) {
+ $user->mfa_provider->prompt({ user => $user, type => $type });
+ exit;
+ }
+
return $self->_handle_login_result($login_info, $type);
}
+sub mfa_verified {
+ my ($self, $user, $type) = @_;
+ require Bugzilla::Auth::Login::CGI;
+ $self->{_info_getter}->{successful} = Bugzilla::Auth::Login::CGI->new();
+ $self->_handle_login_result({ user => $user }, $type);
+ print Bugzilla->cgi->redirect('index.cgi');
+ exit;
+}
+
sub successful_info_getter {
my ($self) = @_;