summaryrefslogtreecommitdiff
path: root/lib/json_web_token
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/json_web_token
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/json_web_token')
-rw-r--r--lib/json_web_token/hmac_token.rb6
-rw-r--r--lib/json_web_token/rsa_token.rb6
-rw-r--r--lib/json_web_token/token.rb4
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/json_web_token/hmac_token.rb b/lib/json_web_token/hmac_token.rb
index ec0917ab49d..2275c0e3a1d 100644
--- a/lib/json_web_token/hmac_token.rb
+++ b/lib/json_web_token/hmac_token.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require 'jwt'
+require "jwt"
module JSONWebToken
class HMACToken < Token
IAT_LEEWAY = 60
- JWT_ALGORITHM = 'HS256'
+ JWT_ALGORITHM = "HS256"
def initialize(secret)
super()
@@ -18,7 +18,7 @@ module JSONWebToken
end
def encoded
- JWT.encode(payload, secret, JWT_ALGORITHM, { typ: 'JWT' })
+ JWT.encode(payload, secret, JWT_ALGORITHM, {typ: "JWT"})
end
private
diff --git a/lib/json_web_token/rsa_token.rb b/lib/json_web_token/rsa_token.rb
index bcce811cd28..021d5b7258a 100644
--- a/lib/json_web_token/rsa_token.rb
+++ b/lib/json_web_token/rsa_token.rb
@@ -12,9 +12,9 @@ module JSONWebToken
def encoded
headers = {
kid: kid,
- typ: 'JWT'
+ typ: "JWT",
}
- JWT.encode(payload, key, 'RS256', headers)
+ JWT.encode(payload, key, "RS256", headers)
end
private
@@ -39,7 +39,7 @@ module JSONWebToken
kid = Base32.encode(kid[0..29])
# insert colon every 4 characters
- kid.scan(/.{4}/).join(':')
+ kid.scan(/.{4}/).join(":")
end
end
end
diff --git a/lib/json_web_token/token.rb b/lib/json_web_token/token.rb
index c59beef02c9..f69a86ef5cc 100644
--- a/lib/json_web_token/token.rb
+++ b/lib/json_web_token/token.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'securerandom'
+require "securerandom"
module JSONWebToken
class Token
@@ -46,7 +46,7 @@ module JSONWebToken
iss: issuer,
iat: issued_at.to_i,
nbf: not_before.to_i,
- exp: expire_time.to_i
+ exp: expire_time.to_i,
}.compact
end
end