summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-01-29 18:33:12 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-01-29 18:33:12 +0100
commitc8447e9f4b7c17ab0e04af34dbd5583e78b23677 (patch)
tree573093df276637e98796717c325c3fc5c040263d /Bugzilla/WebService
parent89d319922df1160f346321acfa6a9c5d69b5ed43 (diff)
downloadbugzilla-c8447e9f4b7c17ab0e04af34dbd5583e78b23677.tar.gz
bugzilla-c8447e9f4b7c17ab0e04af34dbd5583e78b23677.tar.xz
Bug 1045145: backport upstream bug 726696 to bmo/4.2 to allow use of api keys for authentication
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Constants.pm3
-rw-r--r--Bugzilla/WebService/User.pm22
-rw-r--r--Bugzilla/WebService/Util.pm5
3 files changed, 27 insertions, 3 deletions
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm
index 83cae251b..34981c565 100644
--- a/Bugzilla/WebService/Constants.pm
+++ b/Bugzilla/WebService/Constants.pm
@@ -149,6 +149,9 @@ use constant WS_ERROR_CODE => {
extern_id_conflict => -303,
auth_failure => 304,
password_current_too_short => 305,
+ api_key_not_valid => 306,
+ api_key_revoked => 306,
+ auth_invalid_token => 307,
# Except, historically, AUTH_NODATA, which is 410.
login_required => 410,
diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm
index 2f38446b8..773a7cec3 100644
--- a/Bugzilla/WebService/User.pm
+++ b/Bugzilla/WebService/User.pm
@@ -439,9 +439,13 @@ where applicable.
=head1 Logging In and Out
+These method are now deprecated, and will be removed in the release after
+Bugzilla 5.0. The correct way of use these REST and RPC calls is noted in
+L<Bugzilla::WebService>
+
=head2 login
-B<STABLE>
+B<DEPRECATED>
=over
@@ -504,11 +508,21 @@ A login or password parameter was not provided.
=back
+=item B<History>
+
+=over
+
+=item C<token> was added in Bugzilla B<4.4.3>.
+
+=item This function will be removed in the release after Bugzilla 5.0, in favour of API keys.
+
+=back
+
=back
=head2 logout
-B<STABLE>
+B<DEPRECATED>
=over
@@ -526,7 +540,7 @@ Log out the user. Does nothing if there is no user logged in.
=head2 valid_login
-B<UNSTABLE>
+B<DEPRECATED>
=over
@@ -564,6 +578,8 @@ for the provided username.
=item Added in Bugzilla B<5.0>.
+=item This function will be removed in the release after Bugzilla 5.0, in favour of API keys.
+
=back
=back
diff --git a/Bugzilla/WebService/Util.pm b/Bugzilla/WebService/Util.pm
index c21bcd344..44bfb1f70 100644
--- a/Bugzilla/WebService/Util.pm
+++ b/Bugzilla/WebService/Util.pm
@@ -279,6 +279,11 @@ sub fix_credentials {
$params->{'Bugzilla_login'} = delete $params->{'login'};
$params->{'Bugzilla_password'} = delete $params->{'password'};
}
+ # Allow user to pass api_key=12345678 as a convenience which becomes
+ # "Bugzilla_api_key" which is what the auth code looks for.
+ if (exists $params->{api_key}) {
+ $params->{Bugzilla_api_key} = delete $params->{api_key};
+ }
# Allow user to pass token=12345678 as a convenience which becomes
# "Bugzilla_token" which is what the auth code looks for.
if (exists $params->{'token'}) {