diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-13 16:43:49 -0500 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-13 16:43:49 -0500 |
commit | 692b5e0b47931bf173e92dab3d01b502fd284285 (patch) | |
tree | ce14cde539ae8994a2484e82ead22a08472514e1 /lib | |
parent | 9e318bd99deb90a93130cd4ef79e54f18555d4dc (diff) | |
parent | 509654b3784da2a084a0c8303e9c6cc1498b8d2b (diff) | |
download | gitlab-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.rb | 10 |
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 |