summaryrefslogtreecommitdiffstats
path: root/extensions/BrowserID
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-01-07 22:05:19 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-01-07 22:05:19 +0100
commit240077ef7e91afb8cc89866c06fa2ca39d6a0c03 (patch)
tree6453d25d1a2843e17a65163a16c4fc13742ba606 /extensions/BrowserID
parentea3776c06f7562eed413c44fc9a061ca6102f4df (diff)
downloadbugzilla-240077ef7e91afb8cc89866c06fa2ca39d6a0c03.tar.gz
bugzilla-240077ef7e91afb8cc89866c06fa2ca39d6a0c03.tar.xz
Bug 820183 - BrowserID extension should allow custom configuration of browserid hostnames to use for verification
r=glob
Diffstat (limited to 'extensions/BrowserID')
-rw-r--r--extensions/BrowserID/Extension.pm6
-rw-r--r--extensions/BrowserID/lib/Config.pm35
-rw-r--r--extensions/BrowserID/lib/Login.pm4
-rw-r--r--extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl20
-rw-r--r--extensions/BrowserID/template/en/default/hook/account/auth/login-additional_methods.html.tmpl5
-rw-r--r--extensions/BrowserID/template/en/default/hook/account/auth/login-small-additional_methods.html.tmpl5
6 files changed, 69 insertions, 6 deletions
diff --git a/extensions/BrowserID/Extension.pm b/extensions/BrowserID/Extension.pm
index 873cca8e3..f4d7e32b5 100644
--- a/extensions/BrowserID/Extension.pm
+++ b/extensions/BrowserID/Extension.pm
@@ -46,4 +46,10 @@ sub config_modify_panels {
}
}
+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/lib/Config.pm b/extensions/BrowserID/lib/Config.pm
new file mode 100644
index 000000000..9d47e52e2
--- /dev/null
+++ b/extensions/BrowserID/lib/Config.pm
@@ -0,0 +1,35 @@
+# 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://browserid.org/verify',
+ },
+ {
+ name => 'browserid_includejs_url',
+ type => 't',
+ default => 'https://browserid.org/include.js',
+ }
+ );
+
+ return @param_list;
+}
+
+1;
diff --git a/extensions/BrowserID/lib/Login.pm b/extensions/BrowserID/lib/Login.pm
index c3d87c958..d87c6f15c 100644
--- a/extensions/BrowserID/lib/Login.pm
+++ b/extensions/BrowserID/lib/Login.pm
@@ -45,7 +45,7 @@ sub get_login_info {
# in the page.
$cgi->delete('browserid_assertion');
- if (!$assertion) {
+ if (!$assertion || !Bugzilla->params->{browserid_verify_url}) {
return { failure => AUTH_NODATA };
}
@@ -60,7 +60,7 @@ sub get_login_info {
my $info = { 'status' => 'browserid-server-broken' };
eval {
- my $response = $ua->post("https://browserid.org/verify",
+ my $response = $ua->post(Bugzilla->params->{browserid_verify_url},
[assertion => $assertion,
audience => $audience]);
diff --git a/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl b/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl
new file mode 100644
index 000000000..be60e612b
--- /dev/null
+++ b/extensions/BrowserID/template/en/default/admin/params/browserid.html.tmpl
@@ -0,0 +1,20 @@
+[%# 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_server => "This is the URL for the BrowserID (Persona) authority that the " _
+ "user will be verified against. Example: <kbd>https://browserid.org</kbd>.",
+ browserid_includejs_server => "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
index 3a0ecb1cc..57f7da8ce 100644
--- 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
@@ -1,9 +1,10 @@
-[% IF Param('user_info_class').split(',').contains('BrowserID') %]
+[% IF Param('user_info_class').split(',').contains('BrowserID')
+ && Param('browserid_includejs_url') %]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
-<script src="https://browserid.org/include.js" type="text/javascript"></script>
+<script src="[% Param('browserid_includejs_url') %]" type="text/javascript"></script>
<script type="text/javascript">
function createHidden(name, value, form) {
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
index 08e68a690..b1c186493 100644
--- 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
@@ -1,5 +1,6 @@
-[% IF Param('user_info_class').split(',').contains('BrowserID') %]
-<script src="https://browserid.org/include.js" type="text/javascript"></script>
+[% IF Param('user_info_class').split(',').contains('BrowserID')
+ && Param('browserid_includejs_url') %]
+<script src="[% Param('browserid_includejs_url') %]" type="text/javascript"></script>
[%# Note this code is a tiny bit different from the other copy; the name of
# the variable containing the login url is 'login_target' rather than