summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-13 16:43:49 -0500
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-13 16:43:49 -0500
commit692b5e0b47931bf173e92dab3d01b502fd284285 (patch)
treece14cde539ae8994a2484e82ead22a08472514e1 /lib
parent9e318bd99deb90a93130cd4ef79e54f18555d4dc (diff)
parent509654b3784da2a084a0c8303e9c6cc1498b8d2b (diff)
downloadgitlab-ce-692b5e0b47931bf173e92dab3d01b502fd284285.tar.gz
Merge branch 'docker-registry' into docker-registry-view
# Conflicts: # app/controllers/jwt_controller.rb # app/services/jwt/container_registry_authentication_service.rb
Diffstat (limited to 'lib')
-rw-r--r--lib/jwt/rsa_token.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/jwt/rsa_token.rb b/lib/jwt/rsa_token.rb
index 0438135ad54..4de89bf0d37 100644
--- a/lib/jwt/rsa_token.rb
+++ b/lib/jwt/rsa_token.rb
@@ -24,11 +24,13 @@ module JWT
@key ||= OpenSSL::PKey::RSA.new(key_data)
end
+ def public_key
+ key.public_key
+ end
+
def kid
- sha256 = Digest::SHA256.new
- sha256.update(key.public_key.to_der)
- payload = StringIO.new(sha256.digest).read(30)
- Base32.encode(payload).split('').each_slice(4).each_with_object([]) do |slice, mem|
+ fingerprint = Digest::SHA256.digest(public_key.to_der)
+ Base32.encode(fingerprint).split('').each_slice(4).each_with_object([]) do |slice, mem|
mem << slice.join
end.join(':')
end