summaryrefslogtreecommitdiff
path: root/lib/api/internal.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-25 09:47:36 +0000
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-01-25 10:00:17 +0000
commit4903ff93971d28723ed9d81f7dae2ad2a1d5586a (patch)
tree8f6f5cbc302f0820c1ffd0c85528388fd33bb8d7 /lib/api/internal.rb
parent3805cd7ac5e1c9b286bfba667ef45972eab4d084 (diff)
parent944c1eb684fe979339262ba6e9f7bf9e1b77fc81 (diff)
downloadgitlab-ce-13931-custom-emoji-implementation.tar.gz
Merge branch 'master' into 13931-custom-emoji-implementation13931-custom-emoji-implementation
Conflicts: app/assets/javascripts/dispatcher.js app/assets/javascripts/pages/projects/shared/project_avatar.js
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r--lib/api/internal.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 79b302aae70..063f0d6599c 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -82,6 +82,18 @@ module API
end
#
+ # Get a ssh key using the fingerprint
+ #
+ get "/authorized_keys" do
+ fingerprint = params.fetch(:fingerprint) do
+ Gitlab::InsecureKeyFingerprint.new(params.fetch(:key)).fingerprint
+ end
+ key = Key.find_by(fingerprint: fingerprint)
+ not_found!("Key") if key.nil?
+ present key, with: Entities::SSHKey
+ end
+
+ #
# Discover user by ssh key or user id
#
get "/discover" do
@@ -91,6 +103,7 @@ module API
elsif params[:user_id]
user = User.find_by(id: params[:user_id])
end
+
present user, with: Entities::UserSafe
end