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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/rails/vault/jwt/concerns/auth_required.rb +8 -1
- data/lib/rails/vault/jwt/config.rb +5 -1
- data/lib/rails/vault/jwt/decoder.rb +2 -1
- data/lib/rails/vault/jwt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e98d1ead636aace41ef9d43c1b0b7fc77360c424350f99307c9640e026332f17
|
4
|
+
data.tar.gz: 39caca480fe0b148c4d6a2ae7318236ffcfa69828662be240948537a2e07cb7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 892bffc18c4d012fc25700aaf401087aad508079d9833e1b8468e3671d3a63c9a371e051111c25b30692d0a8af3bfabb6125ec23be7c9e040c28b403d5e64346
|
7
|
+
data.tar.gz: c33839375ac8bedfd7c7a3bafcd272955d6956b7ddeca105823ea3045d228d364c8f2f37c698455cc31e2a1de6ddae6cbe71d51f9c120073166d7d321dda4731
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|