Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e2a4051c
Commit
e2a4051c
authored
Apr 15, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow personal access tokens to be specified in a header.
- In addition to a param.
parent
5fb44192
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lib/api/helpers/authentication.rb
lib/api/helpers/authentication.rb
+4
-4
No files found.
lib/api/helpers/authentication.rb
View file @
e2a4051c
...
...
@@ -6,6 +6,7 @@ module API
SUDO_HEADER
=
"HTTP_SUDO"
SUDO_PARAM
=
:sudo
PERSONAL_ACCESS_TOKEN_PARAM
=
:personal_access_token
PERSONAL_ACCESS_TOKEN_HEADER
=
"HTTP_PERSONAL_ACCESS_TOKEN"
def
find_user_by_private_token
private_token
=
(
params
[
PRIVATE_TOKEN_PARAM
]
||
env
[
PRIVATE_TOKEN_HEADER
]).
to_s
...
...
@@ -13,10 +14,9 @@ module API
end
def
find_user_by_personal_access_token
personal_access_token
=
PersonalAccessToken
.
find_by_token
(
params
[
PERSONAL_ACCESS_TOKEN_PARAM
])
if
personal_access_token
personal_access_token
.
user
end
personal_access_token_string
=
(
params
[
PERSONAL_ACCESS_TOKEN_PARAM
]
||
env
[
PERSONAL_ACCESS_TOKEN_HEADER
]).
to_s
personal_access_token
=
PersonalAccessToken
.
find_by_token
(
personal_access_token_string
)
personal_access_token
.
user
if
personal_access_token
end
def
current_user
...
...
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