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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2d5397d9
Commit
2d5397d9
authored
Nov 10, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed method handle_return_value
parent
130a9933
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
lib/gitlab/auth/user_auth_finders.rb
lib/gitlab/auth/user_auth_finders.rb
+8
-13
No files found.
lib/gitlab/auth/user_auth_finders.rb
View file @
2d5397d9
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
token
=
current_request
.
params
[
:rss_token
].
presence
token
=
current_request
.
params
[
:rss_token
].
presence
return
unless
token
return
unless
token
handle_return_value!
(
User
.
find_by_rss_token
(
token
)
)
User
.
find_by_rss_token
(
token
)
||
raise
(
API
::
APIGuard
::
UnauthorizedError
)
end
end
def
find_user_from_access_token
def
find_user_from_access_token
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
validate_access_token!
validate_access_token!
handle_return_value!
(
access_token
.
use
r
)
access_token
.
user
||
raise
(
API
::
APIGuard
::
UnauthorizedErro
r
)
end
end
def
validate_access_token!
(
scopes:
[])
def
validate_access_token!
(
scopes:
[])
...
@@ -41,12 +41,6 @@ module Gitlab
...
@@ -41,12 +41,6 @@ module Gitlab
private
private
def
handle_return_value!
(
value
,
&
block
)
raise
API
::
APIGuard
::
UnauthorizedError
unless
value
block_given?
?
yield
(
value
)
:
value
end
def
access_token
def
access_token
return
@access_token
if
defined?
(
@access_token
)
return
@access_token
if
defined?
(
@access_token
)
...
@@ -63,7 +57,7 @@ module Gitlab
...
@@ -63,7 +57,7 @@ module Gitlab
return
unless
token
return
unless
token
# Expiration, revocation and scopes are verified in `validate_access_token!`
# Expiration, revocation and scopes are verified in `validate_access_token!`
handle_return_value!
(
PersonalAccessToken
.
find_by
(
token:
token
)
)
PersonalAccessToken
.
find_by
(
token:
token
)
||
raise
(
API
::
APIGuard
::
UnauthorizedError
)
end
end
def
find_oauth_access_token
def
find_oauth_access_token
...
@@ -71,11 +65,12 @@ module Gitlab
...
@@ -71,11 +65,12 @@ module Gitlab
return
unless
token
return
unless
token
# Expiration, revocation and scopes are verified in `validate_access_token!`
# Expiration, revocation and scopes are verified in `validate_access_token!`
handle_return_value!
(
OauthAccessToken
.
by_token
(
token
))
do
|
oauth_token
|
oauth_token
=
OauthAccessToken
.
by_token
(
token
)
raise
(
API
::
APIGuard
::
UnauthorizedError
)
unless
oauth_token
oauth_token
.
revoke_previous_refresh_token!
oauth_token
.
revoke_previous_refresh_token!
oauth_token
oauth_token
end
end
end
# Check if the request is GET/HEAD, or if CSRF token is valid.
# Check if the request is GET/HEAD, or if CSRF token is valid.
def
verified_request?
def
verified_request?
...
...
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