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
df65e437
Commit
df65e437
authored
Apr 24, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '30305-oauth-token-push-code' into 'master'
Allow OAuth clients to push code Closes #30305 See merge request !10677
parents
3855751d
bee780e8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
30305-oauth-token-push-code.yml
changelogs/unreleased/30305-oauth-token-push-code.yml
+4
-0
auth.rb
lib/gitlab/auth.rb
+1
-1
auth_spec.rb
spec/lib/gitlab/auth_spec.rb
+1
-1
git_http_spec.rb
spec/requests/git_http_spec.rb
+2
-2
No files found.
changelogs/unreleased/30305-oauth-token-push-code.yml
0 → 100644
View file @
df65e437
---
title
:
Allow OAuth clients to push code
merge_request
:
10677
author
:
lib/gitlab/auth.rb
View file @
df65e437
...
...
@@ -108,7 +108,7 @@ module Gitlab
token
=
Doorkeeper
::
AccessToken
.
by_token
(
password
)
if
valid_oauth_token?
(
token
)
user
=
User
.
find_by
(
id:
token
.
resource_owner_id
)
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:oauth
,
read
_authentication_abilities
)
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:oauth
,
full
_authentication_abilities
)
end
end
end
...
...
spec/lib/gitlab/auth_spec.rb
View file @
df65e437
...
...
@@ -118,7 +118,7 @@ describe Gitlab::Auth, lib: true do
it
'succeeds for OAuth tokens with the `api` scope'
do
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
true
,
login:
'oauth2'
)
expect
(
gl_auth
.
find_for_git_client
(
"oauth2"
,
token_w_api_scope
.
token
,
project:
nil
,
ip:
'ip'
)).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:oauth
,
read
_authentication_abilities
))
expect
(
gl_auth
.
find_for_git_client
(
"oauth2"
,
token_w_api_scope
.
token
,
project:
nil
,
ip:
'ip'
)).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
(
user
,
nil
,
:oauth
,
full
_authentication_abilities
))
end
it
'fails for OAuth tokens with other scopes'
do
...
...
spec/requests/git_http_spec.rb
View file @
df65e437
...
...
@@ -279,10 +279,10 @@ describe 'Git HTTP requests', lib: true do
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
end
it
"uploads get status
401 (no project existence information leak)
"
do
it
"uploads get status
200
"
do
push_get
"
#{
project
.
path_with_namespace
}
.git"
,
user:
'oauth2'
,
password:
@token
.
token
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_http_status
(
200
)
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