diff options
Diffstat (limited to 'extensions/BrowserID')
12 files changed, 0 insertions, 425 deletions
diff --git a/extensions/BrowserID/Config.pm b/extensions/BrowserID/Config.pm deleted file mode 100644 index a55ea8ff0..000000000 --- a/extensions/BrowserID/Config.pm +++ /dev/null @@ -1,43 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the BrowserID Bugzilla Extension. -# -# The Initial Developer of the Original Code is the Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham <gerv@gerv.net> - -package Bugzilla::Extension::BrowserID; -use strict; - -use constant NAME => 'BrowserID'; - -use constant REQUIRED_MODULES => [ - { - package => 'JSON', - module => 'JSON', - version => 0, - }, - { - package => 'libwww-perl', - module => 'LWP::UserAgent', - version => 0, - }, -]; - -use constant OPTIONAL_MODULES => [ -]; - -__PACKAGE__->NAME; diff --git a/extensions/BrowserID/Extension.pm b/extensions/BrowserID/Extension.pm deleted file mode 100644 index f4d7e32b5..000000000 --- a/extensions/BrowserID/Extension.pm +++ /dev/null @@ -1,55 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the BrowserID Bugzilla Extension. -# -# The Initial Developer of the Original Code is the Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham <gerv@gerv.net> - -package Bugzilla::Extension::BrowserID; -use strict; -use base qw(Bugzilla::Extension); - -our $VERSION = '0.01'; - -sub auth_login_methods { - my ($self, $args) = @_; - my $modules = $args->{'modules'}; - if (exists($modules->{'BrowserID'})) { - $modules->{'BrowserID'} = 'Bugzilla/Extension/BrowserID/Login.pm'; - } -} - -sub config_modify_panels { - my ($self, $args) = @_; - my $panels = $args->{'panels'}; - my $auth_panel_params = $panels->{'auth'}->{'params'}; - - my ($user_info_class) = - grep { $_->{'name'} eq 'user_info_class' } @$auth_panel_params; - - if ($user_info_class) { - push(@{ $user_info_class->{'choices'} }, "BrowserID,CGI"); - } -} - -sub config_add_panels { - my ($self, $args) = @_; - my $modules = $args->{panel_modules}; - $modules->{BrowserID} = "Bugzilla::Extension::BrowserID::Config"; -} - -__PACKAGE__->NAME; diff --git a/extensions/BrowserID/TODO b/extensions/BrowserID/TODO deleted file mode 100644 index ac94a3c42..000000000 --- a/extensions/BrowserID/TODO +++ /dev/null @@ -1,19 +0,0 @@ -ToDo: - -* Cache the LWP::UserAgent in Login.pm? - -* Fix Bugzilla::Auth::Login::Stack to allow failure part way down the chain - (currently, it seems that both CGI and BrowserID have to be last in order - to report login failures correctly.) - -* JS inclusions noticeably slow page load. Do we want a local copy of - browserid.js? Do the browserid folks object to that? How can we get good - performance? How can we avoid including it in every logged-in page? Can we - do demand loading onclick, and/or load-on-reveal? - -* Fix -8px margin-bottom hack in login-small-additional_methods.html.tmpl - - - - - diff --git a/extensions/BrowserID/lib/Config.pm b/extensions/BrowserID/lib/Config.pm deleted file mode 100644 index 7ee90d813..000000000 --- a/extensions/BrowserID/lib/Config.pm +++ /dev/null @@ -1,35 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This Source Code Form is "Incompatible With Secondary Licenses", as -# defined by the Mozilla Public License, v. 2.0. -package Bugzilla::Extension::BrowserID::Config; - -use strict; -use warnings; - -use Bugzilla::Config::Common; - -our $sortkey = 1350; - -sub get_param_list { - my ($class) = @_; - - my @param_list = ( - { - name => 'browserid_verify_url', - type => 't', - default => 'https://verifier.login.persona.org/verify', - }, - { - name => 'browserid_includejs_url', - type => 't', - default => 'https://login.persona.org/include.js', - } - ); - - return @param_list; -} - -1; diff --git a/extensions/BrowserID/lib/Login.pm b/extensions/BrowserID/lib/Login.pm deleted file mode 100644 index d87c6f15c..000000000 --- a/extensions/BrowserID/lib/Login.pm +++ /dev/null @@ -1,126 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the BrowserID Bugzilla Extension. -# -# The Initial Developer of the Original Code is the Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham <gerv@gerv.net> - -package Bugzilla::Extension::BrowserID::Login; -use strict; -use base qw(Bugzilla::Auth::Login); - -use Bugzilla::Constants; -use Bugzilla::Util; -use Bugzilla::Error; -use Bugzilla::Token; - -use JSON; -use LWP::UserAgent; - -use constant requires_verification => 0; -use constant is_automatic => 1; -use constant user_can_create_account => 1; - -sub get_login_info { - my ($self) = @_; - - my $cgi = Bugzilla->cgi; - - my $assertion = $cgi->param("browserid_assertion"); - # Avoid the assertion being copied into any 'echoes' of the current URL - # in the page. - $cgi->delete('browserid_assertion'); - - if (!$assertion || !Bugzilla->params->{browserid_verify_url}) { - return { failure => AUTH_NODATA }; - } - - my $token = $cgi->param("token"); - $cgi->delete('token'); - check_hash_token($token, ['login']); - - my $urlbase = new URI(correct_urlbase()); - my $audience = $urlbase->scheme . "://" . $urlbase->host_port; - - my $ua = new LWP::UserAgent(); - - my $info = { 'status' => 'browserid-server-broken' }; - eval { - my $response = $ua->post(Bugzilla->params->{browserid_verify_url}, - [assertion => $assertion, - audience => $audience]); - - $info = decode_json($response->content()); - }; - - if ($info->{'status'} eq "okay" && - $info->{'audience'} eq $audience && - ($info->{'expires'} / 1000) > time()) - { - my $login_data = { - 'username' => $info->{'email'} - }; - - my $result = - Bugzilla::Auth::Verify->create_or_update_user($login_data); - return $result if $result->{'failure'}; - - my $user = $result->{'user'}; - - # You can restrict people in a particular group from logging in using - # BrowserID by making that group a member of a group called - # "no-browser-id". - # - # If you have your "createemailregexp" set up in such a way that a - # newly-created account is a member of "no-browser-id", this code will - # create an account for them and then fail their login. Which isn't - # great, but they can still use normal-Bugzilla-login password - # recovery. - if ($user->in_group('no-browser-id')) { - # We use a custom error here, for greater clarity, rather than - # returning a failure code. - ThrowUserError('browserid_account_too_powerful'); - } - - $login_data->{'user'} = $user; - $login_data->{'user_id'} = $user->id; - - return $login_data; - } - else { - return { failure => AUTH_LOGINFAILED }; - } -} - -# Pinched from Bugzilla::Auth::Login::CGI -sub fail_nodata { - my ($self) = @_; - my $cgi = Bugzilla->cgi; - my $template = Bugzilla->template; - - if (Bugzilla->usage_mode != USAGE_MODE_BROWSER) { - ThrowUserError('login_required'); - } - - print $cgi->header(); - $template->process("account/auth/login.html.tmpl", - { 'target' => $cgi->url(-relative=>1) }) - || ThrowTemplateError($template->error()); - exit; -} - -1; diff --git a/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl b/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl deleted file mode 100644 index e78dbb471..000000000 --- a/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% - title = "BrowserID" - desc = "Configure BrowserID Authentication" -%] - -[% param_descs = { - browserid_verify_url => "This is the URL for the BrowserID authority that the " _ - "user will be verified against. " _ - "Example: <kbd>https://verifier.login.persona.org/verify</kbd>.", - browserid_includejs_url => "This is the URL needed by BrowserID to load the necessary " _ - "javascript library for authentication. " _ - "Example: <kbd>https://browserid.org</kbd>." - } -%] diff --git a/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl deleted file mode 100644 index c79e1204e..000000000 --- a/extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -[% IF Param('user_info_class').split(',').contains('BrowserID') - && Param('browserid_includejs_url') %] -<p> -Or, log in with BrowserID: -<img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_sign_in()"> -</p> -[% END %] diff --git a/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl deleted file mode 100644 index b14dd5d8e..000000000 --- a/extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -[% IF Param('user_info_class').split(',').contains('BrowserID') - && Param('browserid_includejs_url') %] -<script type="text/javascript"> - YAHOO.util.Event.addListener('login_link[% qs_suffix FILTER js %]','click', function () { - var login_link = YAHOO.util.Dom.get('browserid_mini_login[% qs_suffix FILTER js %]'); - YAHOO.util.Dom.removeClass(login_link, 'bz_default_hidden'); - }); - YAHOO.util.Event.addListener('hide_mini_login[% qs_suffix FILTER js %]','click', function () { - var login_link = YAHOO.util.Dom.get('browserid_mini_login[% qs_suffix FILTER js %]'); - YAHOO.util.Dom.addClass(login_link, 'bz_default_hidden'); - }); -</script> -<span id="browserid_mini_login[% qs_suffix FILTER html %]" class="bz_default_hidden"> - <img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_sign_in()" style="margin-bottom: -8px"> or -</span> -[% END %] diff --git a/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl b/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl deleted file mode 100644 index 6f75f5cd7..000000000 --- a/extensions/BrowserID/template/en/default/hook/account/create-additional_methods.html.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% IF Param('user_info_class').split(',').contains('BrowserID') %] -<script type="text/javascript"> -function browserid_create_account() { - navigator.id.getVerifiedEmail(function(assertion) { - if (assertion) { - // This code will be invoked once the user has successfully - // selected an email address they control to sign in with. - document.getElementById('browserid_assertion').value = assertion; - document.getElementById('browserid_form').submit(); - return true; - } - }); -} -</script> - -Or, use your BrowserID account: -<img src="extensions/BrowserID/web/sign_in_orange.png" onclick="browserid_create_account()"> - -<form id="browserid_form" method="POST" action="index.cgi"> - <input type="hidden" name="token" value="[% issue_hash_token(['login']) FILTER html %]"> - <input type="hidden" name="browserid_assertion" id="browserid_assertion" value=""> -</form> -[% END %] diff --git a/extensions/BrowserID/template/en/default/hook/global/header-additional_header.html.tmpl b/extensions/BrowserID/template/en/default/hook/global/header-additional_header.html.tmpl deleted file mode 100644 index 2292edf7f..000000000 --- a/extensions/BrowserID/template/en/default/hook/global/header-additional_header.html.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% RETURN IF user.login - || !Param('browserid_includejs_url') - || !Param('user_info_class').split(',').contains('BrowserID') %] - -[% USE Bugzilla %] -[% cgi = Bugzilla.cgi %] - -[% login_target = cgi.url("-relative" => 1, "-query" => 1) %] -[% IF !login_target OR login_target.match("^token.cgi") %] - [% login_target = "index.cgi" %] -[% END %] - -[% login_target = urlbase _ login_target %] - -<script src="[% Param('browserid_includejs_url') %]" type="text/javascript"></script> - -<script type="text/javascript"> -function createHidden(name, value, form) { - var field = document.createElement('input'); - field.type = 'hidden'; - field.name = name; - field.value = value;; - form.appendChild(field); -} - -function browserid_sign_in() { - navigator.id.get(function(assertion) { - if (assertion) { - // This code will be invoked once the user has successfully - // selected an email address they control to sign in with. - var form = document.createElement('form'); - form.action = '[% login_target FILTER js %]'; - form.method = 'POST'; - form.style.display = 'none'; - - createHidden('token', '[% issue_hash_token(['login']) FILTER js %]', form); - createHidden('Bugzilla_remember', 'on', form); - createHidden('browserid_assertion', assertion, form); - - [% FOREACH field = cgi.param() %] - [% NEXT IF field.search("^(Bugzilla_(login|password|restrictlogin)|token|browserid_assertion)$") %] - [% FOREACH mvalue = cgi.param(field).slice(0) %] - createHidden('[% field FILTER js %]', '[% mvalue FILTER html_linebreak FILTER js %]', form); - [% END %] - [% END %] - - document.body.appendChild(form); - form.submit(); - return true; - } - }); -} -</script> diff --git a/extensions/BrowserID/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/BrowserID/template/en/default/hook/global/user-error-errors.html.tmpl deleted file mode 100644 index ce872abda..000000000 --- a/extensions/BrowserID/template/en/default/hook/global/user-error-errors.html.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -[% IF error == "browserid_account_too_powerful" %] - [% title = "Account Too Powerful" %] - Your account is a member of a group which is not permitted to use - BrowserID to log in. Please log in with your [% terms.Bugzilla %] username - and password. - <br><br> - (BrowserID logins are disabled for accounts which are members of certain - particularly sensitive groups, while we gain experience with the - technology.) -[% END %] diff --git a/extensions/BrowserID/web/sign_in_orange.png b/extensions/BrowserID/web/sign_in_orange.png Binary files differdeleted file mode 100644 index 65ccda473..000000000 --- a/extensions/BrowserID/web/sign_in_orange.png +++ /dev/null |