ruby_jwt 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c26f05952897384ad7d987c432d6e256dd0b4643
4
- data.tar.gz: acdab5df412b9b6bcda49c0a2d2dc6fc4565ceef
3
+ metadata.gz: 199f5c150078773e4e54fc314b2c88af5daf4437
4
+ data.tar.gz: 22a70e353f73a61ee4f2fd6fd2397921b5a60e37
5
5
  SHA512:
6
- metadata.gz: c07bd70e45037595948e4685519b52baf4cc6dbad02f3ab51e1d3b9879cc185f5980044f6ca830f316a9fc651a26a9a2d2c8ab77c519b3462a61214997da5c6e
7
- data.tar.gz: ecf1f0ab9e80f552dc954fa1c1b6e69288d001544f3c4313eedb8c9e3c89c645b71945cc23fda1fecd8db1a8cf295a3744f09b47eee6f7af99048268bd799991
6
+ metadata.gz: f6d7786ddfcdc959caefe9a39a89c0d9b2504fcbdd6b6b725fb8ea586affdce966ac86d9204544f84e2f3ecc1a4cf220be3abd7938e31b14aeb3278095ff8e75
7
+ data.tar.gz: 4a441182be11449f484e0260c781db49cf8cbc595d7f26c2840081b9a9f212b7a2f538ddf6e3633a0544bf7be2880c4dd9e613200df7df388cb38ba0b20ac06f
@@ -41,8 +41,9 @@ module JWT
41
41
  payload_options[:nbf] += payload[:iat]
42
42
  end
43
43
  payload.merge!(payload_options)
44
- jwt_parts << encode_header(header_options)
45
- jwt_parts << encode_payload(payload)
44
+ header_options[:typ] = header_options[:typ] || "JWT"
45
+ jwt_parts << encode_data(header_options)
46
+ jwt_parts << encode_data(payload)
46
47
  jwt_parts << encode_signature(jwt_parts.join("."),key, header_options[:alg])
47
48
  return jwt_parts.join(".")
48
49
  end
@@ -97,13 +98,8 @@ module JWT
97
98
  return JSON.parse(base64urldecode(data),{:symbolize_names => true})
98
99
  end
99
100
 
100
- def encode_header(header_options)
101
- header = {:typ => "JWT"}.merge(header_options)
102
- return base64urlencode(JSON.generate(header))
103
- end
104
-
105
- def encode_payload(payload)
106
- return base64urlencode(JSON.generate(payload))
101
+ def encode_data(data)
102
+ return base64urlencode(JSON.generate(data))
107
103
  end
108
104
 
109
105
  def encode_signature(data,key,alg)
@@ -1,3 +1,3 @@
1
1
  module RubyJwt
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
@@ -7108,3 +7108,198 @@ RubyJwtTest: test_should_encode_and_decode_and_verify_hmac
7108
7108
  RubyJwtTest: test_should_encode_and_decode_none
7109
7109
  -----------------------------------------------
7110
7110
   (0.1ms) rollback transaction
7111
+  (0.1ms) begin transaction
7112
+ -----------------------------------------------------
7113
+ RubyJwtTest: test_decodes_and_verifies_existing_token
7114
+ -----------------------------------------------------
7115
+  (0.0ms) rollback transaction
7116
+  (0.0ms) begin transaction
7117
+ ---------------------------------------------------------
7118
+ RubyJwtTest: test_returns_decode_error_for_invalid_base64
7119
+ ---------------------------------------------------------
7120
+  (0.0ms) rollback transaction
7121
+  (0.0ms) begin transaction
7122
+ ---------------------------------------------
7123
+ RubyJwtTest: test_returns_false_if_before_nbf
7124
+ ---------------------------------------------
7125
+  (0.0ms) rollback transaction
7126
+  (0.0ms) begin transaction
7127
+ ------------------------------------------
7128
+ RubyJwtTest: test_returns_false_if_expired
7129
+ ------------------------------------------
7130
+  (0.0ms) rollback transaction
7131
+  (0.0ms) begin transaction
7132
+ ----------------------------------------------------
7133
+ RubyJwtTest: test_returns_false_if_invalid_signature
7134
+ ----------------------------------------------------
7135
+  (0.0ms) rollback transaction
7136
+  (0.0ms) begin transaction
7137
+ -------------------------------------------------
7138
+ RubyJwtTest: test_returns_false_if_wrong_audience
7139
+ -------------------------------------------------
7140
+  (0.1ms) rollback transaction
7141
+  (0.0ms) begin transaction
7142
+ -----------------------------------------------
7143
+ RubyJwtTest: test_returns_false_if_wrong_issuer
7144
+ -----------------------------------------------
7145
+  (0.0ms) rollback transaction
7146
+  (0.0ms) begin transaction
7147
+ -------------------------------------------------------------------------
7148
+ RubyJwtTest: test_returns_not_implemented_error_for_unsupported_algorithm
7149
+ -------------------------------------------------------------------------
7150
+  (0.0ms) rollback transaction
7151
+  (0.1ms) begin transaction
7152
+ -----------------------------------------------
7153
+ RubyJwtTest: test_returns_sign_error_for_no_key
7154
+ -----------------------------------------------
7155
+  (0.0ms) rollback transaction
7156
+  (0.0ms) begin transaction
7157
+ ------------------------------------------------
7158
+ RubyJwtTest: test_should_encode_and_decode_ECDSA
7159
+ ------------------------------------------------
7160
+  (0.0ms) rollback transaction
7161
+  (0.0ms) begin transaction
7162
+ ----------------------------------------------
7163
+ RubyJwtTest: test_should_encode_and_decode_RSA
7164
+ ----------------------------------------------
7165
+  (0.1ms) rollback transaction
7166
+  (0.0ms) begin transaction
7167
+ ----------------------------------------------------------
7168
+ RubyJwtTest: test_should_encode_and_decode_and_verify_hmac
7169
+ ----------------------------------------------------------
7170
+  (0.0ms) rollback transaction
7171
+  (0.0ms) begin transaction
7172
+ -----------------------------------------------
7173
+ RubyJwtTest: test_should_encode_and_decode_none
7174
+ -----------------------------------------------
7175
+  (0.0ms) rollback transaction
7176
+  (0.1ms) begin transaction
7177
+ -----------------------------------------------------
7178
+ RubyJwtTest: test_decodes_and_verifies_existing_token
7179
+ -----------------------------------------------------
7180
+  (0.0ms) rollback transaction
7181
+  (0.0ms) begin transaction
7182
+ ---------------------------------------------------------
7183
+ RubyJwtTest: test_returns_decode_error_for_invalid_base64
7184
+ ---------------------------------------------------------
7185
+  (0.0ms) rollback transaction
7186
+  (0.0ms) begin transaction
7187
+ ---------------------------------------------
7188
+ RubyJwtTest: test_returns_false_if_before_nbf
7189
+ ---------------------------------------------
7190
+  (0.0ms) rollback transaction
7191
+  (0.0ms) begin transaction
7192
+ ------------------------------------------
7193
+ RubyJwtTest: test_returns_false_if_expired
7194
+ ------------------------------------------
7195
+  (0.1ms) rollback transaction
7196
+  (0.0ms) begin transaction
7197
+ ----------------------------------------------------
7198
+ RubyJwtTest: test_returns_false_if_invalid_signature
7199
+ ----------------------------------------------------
7200
+  (0.0ms) rollback transaction
7201
+  (0.1ms) begin transaction
7202
+ -------------------------------------------------
7203
+ RubyJwtTest: test_returns_false_if_wrong_audience
7204
+ -------------------------------------------------
7205
+  (0.0ms) rollback transaction
7206
+  (0.0ms) begin transaction
7207
+ -----------------------------------------------
7208
+ RubyJwtTest: test_returns_false_if_wrong_issuer
7209
+ -----------------------------------------------
7210
+  (0.0ms) rollback transaction
7211
+  (0.0ms) begin transaction
7212
+ -------------------------------------------------------------------------
7213
+ RubyJwtTest: test_returns_not_implemented_error_for_unsupported_algorithm
7214
+ -------------------------------------------------------------------------
7215
+  (0.0ms) rollback transaction
7216
+  (0.0ms) begin transaction
7217
+ -----------------------------------------------
7218
+ RubyJwtTest: test_returns_sign_error_for_no_key
7219
+ -----------------------------------------------
7220
+  (0.0ms) rollback transaction
7221
+  (0.0ms) begin transaction
7222
+ ------------------------------------------------
7223
+ RubyJwtTest: test_should_encode_and_decode_ECDSA
7224
+ ------------------------------------------------
7225
+  (0.0ms) rollback transaction
7226
+  (0.0ms) begin transaction
7227
+ ----------------------------------------------
7228
+ RubyJwtTest: test_should_encode_and_decode_RSA
7229
+ ----------------------------------------------
7230
+  (0.0ms) rollback transaction
7231
+  (0.0ms) begin transaction
7232
+ ----------------------------------------------------------
7233
+ RubyJwtTest: test_should_encode_and_decode_and_verify_hmac
7234
+ ----------------------------------------------------------
7235
+  (0.0ms) rollback transaction
7236
+  (0.1ms) begin transaction
7237
+ -----------------------------------------------
7238
+ RubyJwtTest: test_should_encode_and_decode_none
7239
+ -----------------------------------------------
7240
+  (0.0ms) rollback transaction
7241
+  (0.1ms) begin transaction
7242
+ -----------------------------------------------------
7243
+ RubyJwtTest: test_decodes_and_verifies_existing_token
7244
+ -----------------------------------------------------
7245
+  (0.0ms) rollback transaction
7246
+  (0.0ms) begin transaction
7247
+ ---------------------------------------------------------
7248
+ RubyJwtTest: test_returns_decode_error_for_invalid_base64
7249
+ ---------------------------------------------------------
7250
+  (0.0ms) rollback transaction
7251
+  (0.0ms) begin transaction
7252
+ ---------------------------------------------
7253
+ RubyJwtTest: test_returns_false_if_before_nbf
7254
+ ---------------------------------------------
7255
+  (0.1ms) rollback transaction
7256
+  (0.0ms) begin transaction
7257
+ ------------------------------------------
7258
+ RubyJwtTest: test_returns_false_if_expired
7259
+ ------------------------------------------
7260
+  (0.0ms) rollback transaction
7261
+  (0.0ms) begin transaction
7262
+ ----------------------------------------------------
7263
+ RubyJwtTest: test_returns_false_if_invalid_signature
7264
+ ----------------------------------------------------
7265
+  (0.1ms) rollback transaction
7266
+  (0.0ms) begin transaction
7267
+ -------------------------------------------------
7268
+ RubyJwtTest: test_returns_false_if_wrong_audience
7269
+ -------------------------------------------------
7270
+  (0.0ms) rollback transaction
7271
+  (0.0ms) begin transaction
7272
+ -----------------------------------------------
7273
+ RubyJwtTest: test_returns_false_if_wrong_issuer
7274
+ -----------------------------------------------
7275
+  (0.0ms) rollback transaction
7276
+  (0.0ms) begin transaction
7277
+ -------------------------------------------------------------------------
7278
+ RubyJwtTest: test_returns_not_implemented_error_for_unsupported_algorithm
7279
+ -------------------------------------------------------------------------
7280
+  (0.0ms) rollback transaction
7281
+  (0.0ms) begin transaction
7282
+ -----------------------------------------------
7283
+ RubyJwtTest: test_returns_sign_error_for_no_key
7284
+ -----------------------------------------------
7285
+  (0.0ms) rollback transaction
7286
+  (0.1ms) begin transaction
7287
+ ------------------------------------------------
7288
+ RubyJwtTest: test_should_encode_and_decode_ECDSA
7289
+ ------------------------------------------------
7290
+  (0.0ms) rollback transaction
7291
+  (0.0ms) begin transaction
7292
+ ----------------------------------------------
7293
+ RubyJwtTest: test_should_encode_and_decode_RSA
7294
+ ----------------------------------------------
7295
+  (0.0ms) rollback transaction
7296
+  (0.0ms) begin transaction
7297
+ ----------------------------------------------------------
7298
+ RubyJwtTest: test_should_encode_and_decode_and_verify_hmac
7299
+ ----------------------------------------------------------
7300
+  (0.0ms) rollback transaction
7301
+  (0.0ms) begin transaction
7302
+ -----------------------------------------------
7303
+ RubyJwtTest: test_should_encode_and_decode_none
7304
+ -----------------------------------------------
7305
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Weston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails