rails-vault-jwt 0.1.0 → 0.1.1

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: 410f4ef7c6b7f8ce74ffed0d7d99c5ebe753151b9db6b5db1d218b7ecbbd8c18
4
- data.tar.gz: cfc364e819fe4af7c31b905c4bb0b69b197ffe623655e4c6bf7778bdc0811cfe
3
+ metadata.gz: e98d1ead636aace41ef9d43c1b0b7fc77360c424350f99307c9640e026332f17
4
+ data.tar.gz: 39caca480fe0b148c4d6a2ae7318236ffcfa69828662be240948537a2e07cb7d
5
5
  SHA512:
6
- metadata.gz: b55438c67edc9375487e8546254ab3b48da37a183d84a1374123976944b21f94a72904032e88957257bd43f8a8b7ef36996d588acc469010719d3caea1b921cc
7
- data.tar.gz: 256f556c85fd42c8640d157063d338c25d886b34a61f7c69e4fb365f51ce9b846e78cd68ff117b948e6c3fcc69398614983eb1eb8d0fc87f0f75b747ef266be5
6
+ metadata.gz: 892bffc18c4d012fc25700aaf401087aad508079d9833e1b8468e3671d3a63c9a371e051111c25b30692d0a8af3bfabb6125ec23be7c9e040c28b403d5e64346
7
+ data.tar.gz: c33839375ac8bedfd7c7a3bafcd272955d6956b7ddeca105823ea3045d228d364c8f2f37c698455cc31e2a1de6ddae6cbe71d51f9c120073166d7d321dda4731
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.1] - 2021-01-18
10
+ ### Added
11
+ - Very basic logging around some errors
12
+
9
13
  ## [0.1.0] - 2021-01-17
10
14
  ### Added
11
15
  - Initial commit
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-vault-jwt (0.1.0)
4
+ rails-vault-jwt (0.1.1)
5
5
  activesupport (~> 6.1)
6
6
  jwt (~> 2.2)
7
7
  vault (~> 0.15)
@@ -20,7 +20,8 @@ module Rails
20
20
  render json: { errors: ['Not Authenticated'] }, status: :unauthorized
21
21
  nil
22
22
  end
23
- rescue ::JWT::VerificationError, ::JWT::DecodeError
23
+ rescue ::JWT::VerificationError, ::JWT::DecodeError => e
24
+ JWT.config.logger.debug { "Error while verifying token: #{e}" }
24
25
  render json: { errors: ['Not Authenticated'] }, status: :unauthorized
25
26
  end
26
27
 
@@ -28,10 +29,16 @@ module Rails
28
29
 
29
30
  def http_token
30
31
  @http_token ||= (request.headers['Authorization'].split.last if request.headers['Authorization'].present?)
32
+ JWT.config.logger.debug { "@http_token => #{@http_token}" }
33
+
34
+ @http_token
31
35
  end
32
36
 
33
37
  def auth_token
34
38
  @auth_token ||= JWT::Decoder.decode(http_token)
39
+ JWT.config.logger.debug { "@auth_token => #{@auth_token}" }
40
+
41
+ @auth_token
35
42
  end
36
43
 
37
44
  def token_valid?
@@ -7,9 +7,13 @@ module Rails
7
7
  module JWT
8
8
  class Config
9
9
  extend Forwardable
10
- attr_accessor :cache
10
+ attr_accessor :cache, :logger
11
11
  attr_reader :token_provider
12
12
 
13
+ def initialize
14
+ @logger = defined?(Rails) && defined?(Rails.logger) ? Rails.logger : Logger.new($stdout)
15
+ end
16
+
13
17
  def token_provider=(value)
14
18
  @token_provider = if value.is_a? Class
15
19
  value.new
@@ -19,7 +19,8 @@ module Rails
19
19
  jwks: key_provider.keys(issuer(token))
20
20
  }
21
21
  )[0])
22
- rescue StandardError
22
+ rescue StandardError => e
23
+ JWT.config.logger.error "Error while decoding token: #{e}"
23
24
  nil
24
25
  end
25
26
 
@@ -3,7 +3,7 @@
3
3
  module Rails
4
4
  module Vault
5
5
  module JWT
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-vault-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick King