BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
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