Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-08-26 01:26:20 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 20:21:00 +0300
commite40e3fdc8271d1becf7952c7e30546c5abecb79b (patch)
treed2b8ef12a133ea77c598b456d15c46ea55a1e1bd /lib/gitlab/auth.rb
parentf8bd9625f44ae4233c14e473c57becfb7ff15ca9 (diff)
Added LFS support to SSH
- Required on the GitLab Rails side is mostly authentication and API related.
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r--lib/gitlab/auth.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index 91f0270818a..5446093de4d 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -79,12 +79,13 @@ module Gitlab
result =
user_with_password_for_git(login, password) ||
oauth_access_token_check(login, password) ||
+ lfs_token_check(login, password) ||
personal_access_token_check(login, password)
if result
result.type = nil unless result.user
- if result.user && result.user.two_factor_enabled? && result.type == :gitlab_or_ldap
+ if result.user && result.type == :gitlab_or_ldap && result.user.two_factor_enabled?
result.type = :missing_personal_token
end
end
@@ -114,6 +115,16 @@ module Gitlab
Result.new(user, :personal_token) if user == validation
end
end
+
+ def lfs_token_check(login, password)
+ if login == 'lfs-deploy-key'
+ key = DeployKey.find_by_lfs_token(password)
+ Result.new(key, :lfs_deploy_token) if key
+ else
+ user = User.find_by_lfs_token(password)
+ Result.new(user, :lfs_token) if user && user.username == login
+ end
+ end
end
end
end