Commit c5a7a70d authored by Patricio Cano's avatar Patricio Cano

Allow Git over HTTP access using Personal Access Tokens

parent b44b09b3
...@@ -14,6 +14,8 @@ module Gitlab ...@@ -14,6 +14,8 @@ module Gitlab
result.type = :gitlab_or_ldap result.type = :gitlab_or_ldap
elsif result.user = oauth_access_token_check(login, password) elsif result.user = oauth_access_token_check(login, password)
result.type = :oauth result.type = :oauth
elsif result.user = personal_access_token_check(login, password)
result.type = :personal_token
end end
rate_limit!(ip, success: !!result.user || (result.type == :ci), login: login) rate_limit!(ip, success: !!result.user || (result.type == :ci), login: login)
...@@ -82,6 +84,13 @@ module Gitlab ...@@ -82,6 +84,13 @@ module Gitlab
token && token.accessible? && User.find_by(id: token.resource_owner_id) token && token.accessible? && User.find_by(id: token.resource_owner_id)
end end
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 end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment