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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e324a064b198c930d1085ec1b633517467b9fb2d2acd5951be2c3613a17190b
4
- data.tar.gz: d5f1aac2b3638c7ba12e74f74bd365463079140c5789a88da77cbd9c60e5abd7
3
+ metadata.gz: 574e87e13f93a85345b4ed43bcb8263cd043c3eca38be8091ad36b8914fab552
4
+ data.tar.gz: 896da83de80dbb5f670b096b5a7e7fcbf66fc1958eeaab44ca163c02e5c901c4
5
5
  SHA512:
6
- metadata.gz: 23899cec2c6898756fdec308310cd39be9b3ba4da9c9537342678103502bb922a714645ed7c736b78d852abd123e926f1d8918af5f1e352d7ff4ee556ca0eb41
7
- data.tar.gz: 4aa067249c8a651a8f1b68c6cd73f887350fe1ca10536e238912421cf34e0f3557ad4926cc7f0c0520eea83f8d6f220f33b4e6db8b090fda3ce848b6ac1a7d65
6
+ metadata.gz: 75a902f8ebc415dae716e4cf83cc90b03df82de6e50b70941720222995c9d70eedb68e904863972f19df551f43073c383d4d79ec69b6e63bc62da6316da12609
7
+ data.tar.gz: 0cadbcb705af0e7ef9e13ced3902f01bbbfeecf20792b06c7e2d5d449701c8d6f906ca9c99e7273f82b44d46dccf42969c723ff7cfc6b2655200630119ec8702
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jwt-authorizer (1.0.0.beta2)
4
+ jwt-authorizer (1.0.0)
5
5
  jwt (~> 2.1)
6
6
 
7
7
  GEM
@@ -2,6 +2,6 @@
2
2
 
3
3
  module JWT
4
4
  module Authorizer
5
- VERSION = "1.0.0.beta2"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -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["X-Auth-Token"] || req.params["_t"] }
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 << self
7
- def define_accessor_methods(token_class, claim)
8
- define_getter(token_class, claim)
9
- define_setter(token_class, claim)
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 define_getter(token_class, claim)
13
- token_class.send(:define_method, claim.name) { claims[claim.key] }
14
- token_class.send(:alias_method, claim.key, claim.name)
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 define_setter(token_class, claim)
18
- method_name = "#{claim.name}="
19
- token_class.send(:define_method, method_name) { |value| claims[claim.key] = value }
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
- JWT::Token::ClaimBuilder.define_accessor_methods(self, claim)
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.beta2
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-07 00:00:00.000000000 Z
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: 1.3.1
189
+ version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
192
  rubygems_version: 2.7.3