jwt-authorizer 1.0.0.beta2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/jwt/authorizer/version.rb +1 -1
- data/lib/jwt/endpoint_token.rb +1 -1
- data/lib/jwt/token/claim_builder.rb +15 -12
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574e87e13f93a85345b4ed43bcb8263cd043c3eca38be8091ad36b8914fab552
|
4
|
+
data.tar.gz: 896da83de80dbb5f670b096b5a7e7fcbf66fc1958eeaab44ca163c02e5c901c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75a902f8ebc415dae716e4cf83cc90b03df82de6e50b70941720222995c9d70eedb68e904863972f19df551f43073c383d4d79ec69b6e63bc62da6316da12609
|
7
|
+
data.tar.gz: 0cadbcb705af0e7ef9e13ced3902f01bbbfeecf20792b06c7e2d5d449701c8d6f906ca9c99e7273f82b44d46dccf42969c723ff7cfc6b2655200630119ec8702
|
data/Gemfile.lock
CHANGED
data/lib/jwt/endpoint_token.rb
CHANGED
@@ -6,7 +6,7 @@ module JWT
|
|
6
6
|
attr_writer :token_extractor
|
7
7
|
|
8
8
|
def token_extractor
|
9
|
-
@token_extractor ||= proc { |req| req.env["
|
9
|
+
@token_extractor ||= proc { |req| req.env["HTTP_X_AUTH_TOKEN"] || req.params["_t"] }
|
10
10
|
end
|
11
11
|
|
12
12
|
def verify(rack_request)
|
@@ -3,23 +3,26 @@
|
|
3
3
|
module JWT
|
4
4
|
class Token
|
5
5
|
module ClaimBuilder
|
6
|
-
class
|
7
|
-
def
|
8
|
-
|
9
|
-
|
6
|
+
class ClaimAccessor < Module
|
7
|
+
def initialize(claim)
|
8
|
+
super() do
|
9
|
+
define_getters(claim)
|
10
|
+
define_setters(claim)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
14
|
+
def define_getters(claim)
|
15
|
+
define_method(claim.name) { claims[claim.key] }
|
16
|
+
define_method(claim.key) { send(claim.name) } if claim.key != claim.name.to_s
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
token_class.send(:alias_method, "#{claim.key}=", method_name)
|
19
|
+
def define_setters(claim)
|
20
|
+
define_method("#{claim.name}=") { |value| claims[claim.key] = value }
|
21
|
+
define_method("#{claim.key}=") { |value| send("#{claim.name}=", value) } if claim.key != claim.name.to_s
|
21
22
|
end
|
23
|
+
end
|
22
24
|
|
25
|
+
class << self
|
23
26
|
def included(base)
|
24
27
|
base.extend(ClassMethods)
|
25
28
|
super
|
@@ -40,7 +43,7 @@ module JWT
|
|
40
43
|
claim = JWT::Token::Claim.new(name, key, required, verifier).tap(&:freeze)
|
41
44
|
|
42
45
|
claims << claim
|
43
|
-
|
46
|
+
include(ClaimAccessor.new(claim))
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt-authorizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Begejowicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -184,9 +184,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '2.4'
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- - "
|
187
|
+
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
192
|
rubygems_version: 2.7.3
|