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
09c4d8e0
Commit
09c4d8e0
authored
Feb 26, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove user auth logic
parent
d9823a42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
46 deletions
+1
-46
ee/lib/ee/api/api_guard.rb
ee/lib/ee/api/api_guard.rb
+1
-2
ee/lib/ee/gitlab/auth/user_auth_finders.rb
ee/lib/ee/gitlab/auth/user_auth_finders.rb
+0
-23
ee/spec/lib/gitlab/auth/user_auth_finders_spec.rb
ee/spec/lib/gitlab/auth/user_auth_finders_spec.rb
+0
-21
No files found.
ee/lib/ee/api/api_guard.rb
View file @
09c4d8e0
...
...
@@ -10,8 +10,7 @@ module EE
def
find_user_from_sources
find_user_from_access_token
||
find_user_from_job_token
||
find_user_from_warden
||
find_user_from_scim_token
find_user_from_warden
end
end
end
...
...
ee/lib/ee/gitlab/auth/user_auth_finders.rb
View file @
09c4d8e0
...
...
@@ -22,29 +22,6 @@ module EE
job
.
user
end
def
find_oauth_access_token
return
if
scim_request?
super
end
def
find_user_from_scim_token
return
unless
scim_request?
token
=
Doorkeeper
::
OAuth
::
Token
.
from_request
(
current_request
,
*
Doorkeeper
.
configuration
.
access_token_methods
)
return
unless
token
# TODO Use `ScimOauthAccessToken`
scim_token
=
PersonalAccessToken
.
find_by_token
(
token
)
raise
::
Gitlab
::
Auth
::
UnauthorizedError
unless
scim_token
scim_token
.
user
end
def
scim_request?
current_request
.
path
.
starts_with?
(
"/api/scim/"
)
end
end
end
end
...
...
ee/spec/lib/gitlab/auth/user_auth_finders_spec.rb
View file @
09c4d8e0
...
...
@@ -64,25 +64,4 @@ describe Gitlab::Auth::UserAuthFinders do
it_behaves_like
'find user from job token'
end
end
describe
'#find_user_from_scim_token'
do
let
(
:token
)
{
create
(
:personal_access_token
,
user:
user
)
}
before
do
allow
(
request
).
to
receive
(
:path
).
and_return
(
'/api/scim/'
)
allow
(
self
).
to
receive
(
:current_request
).
and_return
(
request
)
end
it
"returns an Unauthorized exception for an invalid token"
do
env
[
'HTTP_AUTHORIZATION'
]
=
"Bearer invalid"
expect
{
find_user_from_scim_token
}.
to
raise_error
(
Gitlab
::
Auth
::
UnauthorizedError
)
end
it
"return user if token is valid"
do
env
[
'HTTP_AUTHORIZATION'
]
=
"Bearer
#{
token
.
token
}
"
expect
(
find_user_from_scim_token
).
to
eq
(
user
)
end
end
end
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