Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
509654b3
Commit
509654b3
authored
May 13, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve JWT::RSAToken::kid
parent
e900ff97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
lib/jwt/rsa_token.rb
lib/jwt/rsa_token.rb
+6
-4
No files found.
lib/jwt/rsa_token.rb
View file @
509654b3
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment