jot-helpers 1.0.0.beta1 → 1.0.0.beta4

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
  SHA256:
3
- metadata.gz: 5dcde07a6ba725c5951e5d4ab452ffb1e7cd671a447cf0cdc0c42594c36f1627
4
- data.tar.gz: 8fadc144567b415ae381ce4b412f4f2a2a4649f3ac75d232e6778047a5093185
3
+ metadata.gz: fbbe16be31ced7f4112c725850272c26bd91fbba4ba060aefc16d6b7292cc85e
4
+ data.tar.gz: c4094b3f477538683ac34be6f428ade5c4c138c290654b8ab9fe3d0814bb8c16
5
5
  SHA512:
6
- metadata.gz: b8bddc2c27c5edc08e629a500a36f32843e58e7550fcd4503d94b6e15aae56709a85df0b5faf426d9e7cb0460a0fbe213d306c2887d2eb96e1025150ed3611ab
7
- data.tar.gz: f2b30a100261522e6e39f3aff5977cde6576ca4bcdda7459e7cdd38810f709cdcd05a569371364c2ed20f747f1ba316747c28459c5b57e9ac0adceaf63c0ce8e
6
+ metadata.gz: 343bb0e4f8a9fa376900f5a684191ff3c8582ca9c7e89edfb1732b16931e147f9fe5df9d105059abaca86c6233d32b14cdec430327610194540291fdd67da9eb
7
+ data.tar.gz: c6214640f8e904216dccb1052d14cc558181ddd0cbb7d1515bd5a5e577bb03b1a2cc09f3870574e10491b5bc42102237be65a1daaa660cabf1f88d4b1ff486b7
data/README.md CHANGED
@@ -18,13 +18,13 @@ end
18
18
  Encode a payload:
19
19
 
20
20
  ```ruby
21
- JOT.encode({ user_id: 1 }) # => "eyJhbGciOiJIUz..."
21
+ Jot.encode({ user_id: 1 }) # => "eyJhbGciOiJIUz..."
22
22
  ```
23
23
 
24
24
  Decode a payload:
25
25
 
26
26
  ```ruby
27
- JOT.decode("eyJhbGciOiJIUz...") # => { "user_id" => 1 }
27
+ Jot.decode("eyJhbGciOiJIUz...") # => { "user_id" => 1 }
28
28
  ```
29
29
 
30
30
  Exceptions raised for invalid / expired tokens will be the same as those raised by the JWT gem.
@@ -1,7 +1,13 @@
1
1
  class Jot
2
+ NoAuthorizationHeaderError = Class.new(StandardError)
3
+
2
4
  module Rails
3
5
  module AuthenticationHelper
4
6
  def jot_decode(request)
7
+ if request.headers["Authorization"].nil?
8
+ raise NoAuthorizationHeaderError, "no Authorization header detected. Cannot decode token."
9
+ end
10
+
5
11
  token = request.headers["Authorization"].split(" ").last
6
12
  payload, header = Jot.decode(token)
7
13
  payload
data/lib/jot/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Jot
4
- VERSION = "1.0.0.beta1"
4
+ VERSION = "1.0.0.beta4"
5
5
  end
@@ -0,0 +1 @@
1
+ require_relative 'jot'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jot-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-03 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -48,16 +48,17 @@ files:
48
48
  - ".rspec"
49
49
  - README.md
50
50
  - Rakefile
51
+ - lib/jot-helpers.rb
51
52
  - lib/jot.rb
52
53
  - lib/jot/configuration.rb
53
54
  - lib/jot/rails/authentication_helper.rb
54
55
  - lib/jot/version.rb
55
56
  - sig/jot.rbs
56
- homepage: https://github.com/radar/jwt
57
+ homepage: https://github.com/radar/jot
57
58
  licenses: []
58
59
  metadata:
59
- homepage_uri: https://github.com/radar/jwt
60
- source_code_uri: https://github.com/radar/jwt
60
+ homepage_uri: https://github.com/radar/jot
61
+ source_code_uri: https://github.com/radar/jot
61
62
  post_install_message:
62
63
  rdoc_options: []
63
64
  require_paths: