warden-jwt_auth 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +0 -1
- data/CHANGELOG.md +4 -0
- data/lib/warden/jwt_auth.rb +23 -36
- data/lib/warden/jwt_auth/version.rb +1 -1
- data/warden-jwt_auth.gemspec +1 -1
- metadata +4 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac884c1ecfe8201fe9973503bcb067186a2683b290828d9b5bac8b3667929f6d
|
4
|
+
data.tar.gz: 26f14054831f628f83c083709fd8e044182eb28bcef092110c48c386009576fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dadca31dc64203c56ca77c98e69a8bfc48813e2bf0a61a52ee8741f7a08df9c71d96aa481ca424e908b3ba1e8f979f36544244e8545bba6b0e83624ab96db1fa
|
7
|
+
data.tar.gz: 3c58c89cb5d42c462b071008c548d85649e1d88d7186e4d4cc9c987d72e9dbab9d2ddf4a3ed9eb99e017d8f0f66b76f4ccdb88ec584ef64b3bdc097ec69a06ee
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.5.0]
|
8
|
+
### Fixed
|
9
|
+
- Fixed dry-configurable compatibility. ([28](https://github.com/waiting-for-dev/warden-jwt_auth/issues/28))
|
10
|
+
|
7
11
|
## [0.4.2] - 2020-03-19
|
8
12
|
### Fixed
|
9
13
|
- Lock dry-configurable dependency to fix upstream regression. ([21](https://github.com/waiting-for-dev/warden-jwt_auth/issues/21))
|
data/lib/warden/jwt_auth.rb
CHANGED
@@ -19,6 +19,27 @@ module Warden
|
|
19
19
|
module JWTAuth
|
20
20
|
extend Dry::Configurable
|
21
21
|
|
22
|
+
def symbolize_keys(hash)
|
23
|
+
hash.each_with_object({}) do |(key, value), memo|
|
24
|
+
memo[key.to_sym] = value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def upcase_first_items(array)
|
29
|
+
array.map do |tuple|
|
30
|
+
method, path = tuple
|
31
|
+
[method.to_s.upcase, path]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def constantize_values(hash)
|
36
|
+
hash.each_with_object({}) do |(key, value), memo|
|
37
|
+
memo[key] = value.is_a?(String) ? Object.const_get(value) : value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module_function :constantize_values, :symbolize_keys, :upcase_first_items
|
42
|
+
|
22
43
|
# The secret used to encode the token
|
23
44
|
setting :secret
|
24
45
|
|
@@ -38,7 +59,7 @@ module Warden
|
|
38
59
|
# @see Interfaces::UserRepository
|
39
60
|
# @see Interfaces::User
|
40
61
|
setting(:mappings, {}) do |value|
|
41
|
-
symbolize_keys(value)
|
62
|
+
constantize_values(symbolize_keys(value))
|
42
63
|
end
|
43
64
|
|
44
65
|
# Array of tuples [request_method, request_path_regex] to match request
|
@@ -75,44 +96,10 @@ module Warden
|
|
75
96
|
#
|
76
97
|
# @see Interfaces::RevocationStrategy
|
77
98
|
setting(:revocation_strategies, {}) do |value|
|
78
|
-
symbolize_keys(value)
|
79
|
-
end
|
80
|
-
|
81
|
-
# :reek:UtilityFunction
|
82
|
-
def self.symbolize_keys(hash)
|
83
|
-
Hash[
|
84
|
-
hash.each_pair do |key, value|
|
85
|
-
[key.to_sym, value]
|
86
|
-
end
|
87
|
-
]
|
88
|
-
end
|
89
|
-
|
90
|
-
# :reek:UtilityFunction
|
91
|
-
def self.upcase_first_items(array)
|
92
|
-
array.map do |tuple|
|
93
|
-
method, path = tuple
|
94
|
-
[method.to_s.upcase, path]
|
95
|
-
end
|
99
|
+
constantize_values(symbolize_keys(value))
|
96
100
|
end
|
97
101
|
|
98
102
|
Import = Dry::AutoInject(config)
|
99
|
-
|
100
|
-
config.instance_eval do
|
101
|
-
def mappings
|
102
|
-
constantize_values(super)
|
103
|
-
end
|
104
|
-
|
105
|
-
def revocation_strategies
|
106
|
-
constantize_values(super)
|
107
|
-
end
|
108
|
-
|
109
|
-
# :reek:UtilityFunction
|
110
|
-
def constantize_values(hash)
|
111
|
-
hash.each_with_object({}) do |(key, value), memo|
|
112
|
-
memo[key] = value.is_a?(String) ? Object.const_get(value) : value
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
103
|
end
|
117
104
|
end
|
118
105
|
|
data/warden-jwt_auth.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
23
|
spec.add_dependency 'dry-auto_inject', '~> 0.6'
|
24
|
-
spec.add_dependency 'dry-configurable', '~> 0.9'
|
24
|
+
spec.add_dependency 'dry-configurable', '~> 0.9'
|
25
25
|
spec.add_dependency 'jwt', '~> 2.1'
|
26
26
|
spec.add_dependency 'warden', '~> 1.2'
|
27
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden-jwt_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Busqué
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-auto_inject
|
@@ -31,9 +31,6 @@ dependencies:
|
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.9'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '0.11'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -41,9 +38,6 @@ dependencies:
|
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: '0.9'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.11'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: jwt
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +228,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
228
|
- !ruby/object:Gem::Version
|
235
229
|
version: '0'
|
236
230
|
requirements: []
|
237
|
-
|
231
|
+
rubyforge_project:
|
232
|
+
rubygems_version: 2.7.8
|
238
233
|
signing_key:
|
239
234
|
specification_version: 4
|
240
235
|
summary: JWT authentication for Warden.
|