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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6e1f9e74
Commit
6e1f9e74
authored
Jan 29, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gitlab_importer' into 'master'
Ability to clone project using oauth2 token See merge request !1447
parents
beb7a425
d74e7322
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
CHANGELOG
CHANGELOG
+2
-0
db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
+5
-0
db/schema.rb
db/schema.rb
+2
-1
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+13
-1
No files found.
CHANGELOG
View file @
6e1f9e74
...
...
@@ -20,6 +20,8 @@ v 7.8.0
- Increate font size when browse source files and diffs
- Create new file in empty repository using GitLab UI
-
- Ability to clone project using oauth2 token
-
- Upgrade Sidekiq gem to version 3.3.0
- Stop git zombie creation during force push check
- Show success/error messages for test setting button in services
...
...
db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
0 → 100644
View file @
6e1f9e74
class
AddGitlabAccessTokenToUser
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:gitlab_access_token
,
:string
end
end
db/schema.rb
View file @
6e1f9e74
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2015011623454
4
)
do
ActiveRecord
::
Schema
.
define
(
version:
2015011623454
5
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -434,6 +434,7 @@ ActiveRecord::Schema.define(version: 20150116234544) do
t
.
string
"website_url"
,
default:
""
,
null:
false
t
.
datetime
"last_credential_check_at"
t
.
string
"github_access_token"
t
.
string
"gitlab_access_token"
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
lib/gitlab/backend/grack_auth.rb
View file @
6e1f9e74
...
...
@@ -34,7 +34,7 @@ module Grack
def
auth!
if
@auth
.
provided?
return
bad_request
unless
@auth
.
basic?
# Authentication with username and password
login
,
password
=
@auth
.
credentials
...
...
@@ -71,8 +71,20 @@ module Grack
false
end
def
oauth_access_token_check
(
login
,
password
)
if
login
==
"oauth2"
&&
git_cmd
==
'git-upload-pack'
&&
password
.
present?
token
=
Doorkeeper
::
AccessToken
.
by_token
(
password
)
token
&&
token
.
accessible?
&&
User
.
find_by
(
id:
token
.
resource_owner_id
)
end
end
def
authenticate_user
(
login
,
password
)
user
=
Gitlab
::
Auth
.
new
.
find
(
login
,
password
)
unless
user
user
=
oauth_access_token_check
(
login
,
password
)
end
return
user
if
user
.
present?
# At this point, we know the credentials were wrong. We let Rack::Attack
...
...
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