From ca30cabb0b4b3085d85edc54171f21d2673c8b6c Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 16 Jun 2015 15:43:04 -0400 Subject: Bug 1163761: Allow MozReview to skip user consent screen for Authentication Delegation --- extensions/MozReview/Extension.pm | 22 ++++++++++++++++++++++ .../params/editparams-current_panel.html.tmpl | 1 + 2 files changed, 23 insertions(+) diff --git a/extensions/MozReview/Extension.pm b/extensions/MozReview/Extension.pm index 1f2758f9f..4e1951ed4 100644 --- a/extensions/MozReview/Extension.pm +++ b/extensions/MozReview/Extension.pm @@ -54,6 +54,17 @@ sub template_before_process { } } +sub auth_delegation_confirm { + my ($self, $args) = @_; + my $mozreview_callback_url = Bugzilla->params->{mozreview_auth_callback_url}; + + return unless $mozreview_callback_url; + + if (index($args->{callback}, $mozreview_callback_url) == 0) { + ${$args->{skip_confirmation}} = 1; + } +} + sub config_modify_panels { my ($self, $args) = @_; push @{ $args->{panels}->{advanced}->{params} }, { @@ -62,6 +73,17 @@ sub config_modify_panels { default => '', checker => \&check_urlbase }; + push @{ $args->{panels}->{advanced}->{params} }, { + name => 'mozreview_auth_callback_url', + type => 't', + default => '', + checker => sub { + my ($url) = (@_); + + return 'must be an HTTP/HTTPS absolute URL' unless $url =~ m{^https?://}; + return ''; + } + }; } __PACKAGE__->NAME; diff --git a/extensions/MozReview/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl b/extensions/MozReview/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl index f16aaddb8..eb08f26eb 100644 --- a/extensions/MozReview/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl +++ b/extensions/MozReview/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl @@ -8,4 +8,5 @@ [% IF panel.name == "advanced" %] [% panel.param_descs.mozreview_base_url = 'MozReview Base URL' %] + [% panel.param_descs.mozreview_auth_callback_url = 'MozReview Auth Delegation URL' %] [% END -%] -- cgit v1.2.3-24-g4f1b