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
Tatuya Kamada
gitlab-ce
Commits
c5a7a70d
Commit
c5a7a70d
authored
Aug 10, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Git over HTTP access using Personal Access Tokens
parent
b44b09b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+9
-0
No files found.
lib/gitlab/auth.rb
View file @
c5a7a70d
...
...
@@ -14,6 +14,8 @@ module Gitlab
result
.
type
=
:gitlab_or_ldap
elsif
result
.
user
=
oauth_access_token_check
(
login
,
password
)
result
.
type
=
:oauth
elsif
result
.
user
=
personal_access_token_check
(
login
,
password
)
result
.
type
=
:personal_token
end
rate_limit!
(
ip
,
success:
!!
result
.
user
||
(
result
.
type
==
:ci
),
login:
login
)
...
...
@@ -82,6 +84,13 @@ module Gitlab
token
&&
token
.
accessible?
&&
User
.
find_by
(
id:
token
.
resource_owner_id
)
end
end
def
personal_access_token_check
(
login
,
password
)
if
login
&&
password
user
=
User
.
find_by_personal_access_token
(
password
)
user
if
user
&&
user
.
username
==
login
end
end
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