Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
de0781fd
Commit
de0781fd
authored
Mar 09, 2015
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1139755: Allow API authentication with X-Headers
r=dkl,a=glob
parent
243d66a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
JSONRPC.pm
Bugzilla/WebService/Server/JSONRPC.pm
+1
-1
REST.pm
Bugzilla/WebService/Server/REST.pm
+1
-1
Util.pm
Bugzilla/WebService/Util.pm
+19
-1
No files found.
Bugzilla/WebService/Server/JSONRPC.pm
View file @
de0781fd
...
@@ -379,7 +379,7 @@ sub _argument_type_check {
...
@@ -379,7 +379,7 @@ sub _argument_type_check {
# Update the params to allow for several convenience key/values
# Update the params to allow for several convenience key/values
# use for authentication
# use for authentication
fix_credentials
(
$params
);
fix_credentials
(
$params
,
$self
->
cgi
);
Bugzilla
->
input_params
(
$params
);
Bugzilla
->
input_params
(
$params
);
...
...
Bugzilla/WebService/Server/REST.pm
View file @
de0781fd
...
@@ -76,7 +76,7 @@ sub handle {
...
@@ -76,7 +76,7 @@ sub handle {
my
$params
=
$self
->
_retrieve_json_params
;
my
$params
=
$self
->
_retrieve_json_params
;
fix_credentials
(
$params
);
fix_credentials
(
$params
,
$self
->
cgi
);
# Fix includes/excludes for each call
# Fix includes/excludes for each call
rest_include_exclude
(
$params
);
rest_include_exclude
(
$params
);
...
...
Bugzilla/WebService/Util.pm
View file @
de0781fd
...
@@ -16,6 +16,7 @@ use Bugzilla::FlagType;
...
@@ -16,6 +16,7 @@ use Bugzilla::FlagType;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
use
Storable
qw(dclone)
;
use
Storable
qw(dclone)
;
use
URI::
Escape
qw(uri_unescape)
;
use
parent
qw(Exporter)
;
use
parent
qw(Exporter)
;
...
@@ -260,8 +261,25 @@ sub params_to_objects {
...
@@ -260,8 +261,25 @@ sub params_to_objects {
return
\
@objects
;
return
\
@objects
;
}
}
use
constant
X_HEADERS
=>
{
X_BUGZILLA_LOGIN
=>
'Bugzilla_login'
,
X_BUGZILLA_PASSWORD
=>
'Bugzilla_password'
,
X_BUGZILLA_API_KEY
=>
'Bugzilla_api_key'
,
X_BUGZILLA_TOKEN
=>
'Bugzilla_token'
,
};
sub
fix_credentials
{
sub
fix_credentials
{
my
(
$params
)
=
@_
;
my
(
$params
,
$cgi
)
=
@_
;
# Allow user to pass in authentication details in X-Headers
# This allows callers to keep credentials out of GET request query-strings
if
(
$cgi
)
{
foreach
my
$field
(
keys
%
{
X_HEADERS
()
})
{
next
if
exists
$params
->
{
X_HEADERS
->
{
$field
}}
||
$cgi
->
http
(
$field
)
eq
''
;
$params
->
{
X_HEADERS
->
{
$field
}}
=
uri_unescape
(
$cgi
->
http
(
$field
));
}
}
# Allow user to pass in login=foo&password=bar as a convenience
# Allow user to pass in login=foo&password=bar as a convenience
# even if not calling GET /login. We also do not delete them as
# even if not calling GET /login. We also do not delete them as
# GET /login requires "login" and "password".
# GET /login requires "login" and "password".
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment