doorkeeper-jwt 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: 92e4e37830ecbed4396d8d8aca91898759e15de9
4
- data.tar.gz: ac9fb57d4e5f11f02c6e483437f96b95e6c3c1bd
3
+ metadata.gz: f9ccfe46d3353aab84a2a11554970f4c8d784824
4
+ data.tar.gz: a674ffb947b6df31dcf1dd1fdefc660530a9d3b6
5
5
  SHA512:
6
- metadata.gz: b5a613775e07bdf7436ade61979910550e98c2527d117ffefc2f0a0ef7ec40ebe2a74fb1a68b500e04065129f4f56e9ff49f21e6604b34a0d668bfed7818ecd8
7
- data.tar.gz: d6ea6b6b2a0caa80e29288f12814251da78bbfade9a4fd51fc4a91188e76ed0549c4168443c3654b1d86c643fa21ea911cabd31b8259375d8ca269f5e0642c66
6
+ metadata.gz: 598c6248361ad6cf25e1bd5df14720696a1e671d13c808ad06217e3f54b3aa1ae01e8664bebef975bb225bea6837bcd7db67d6aa7c58c88a4f518c372ac5dab2
7
+ data.tar.gz: 5103722a7035d3b494a5b2ee79f61559980d2b4b5234a2269ddc206bb9eea8689146e6da13a5e1cbde01fdec5c64ecca3e0ab377e6bc27c31d8617b160f800d0
data/README.md CHANGED
@@ -4,10 +4,10 @@
4
4
 
5
5
  # Doorkeeper::JWT
6
6
 
7
- Doorkeeper JWT adds JWT token support to the Doorkeeper OAuth library. Requires Doorkeeper 2.2.0 or newer. Until it is released (expected mid-April, 2015), you can load the necessary commit that addis custom token support in your gemfile.
7
+ Doorkeeper JWT adds JWT token support to the Doorkeeper OAuth library. Requires Doorkeeper 2.2.0 or newer.
8
8
 
9
9
  ```ruby
10
- gem 'doorkeeper', git: "git://github.com/doorkeeper/doorkeeper-gem", ref: '910112'
10
+ gem 'doorkeeper'
11
11
  ```
12
12
 
13
13
  ## Installation
@@ -45,9 +45,18 @@ module Doorkeeper
45
45
  end
46
46
 
47
47
  def application_secret(opts)
48
- opts = { application: {} }.merge(opts)
49
- return opts[:application][:secret] if opts[:application][:secret]
50
- fail "JWT `use_application_secret` config set, but no app secret set."
48
+ if opts[:application].nil?
49
+ fail "JWT `use_application_secret` is enabled but application is " \
50
+ "nil. This can happen if `client_id` was absent in the request " \
51
+ "params."
52
+ end
53
+
54
+ if opts[:application][:secret].nil?
55
+ fail "JWT `use_application_secret` is enabled but the application " \
56
+ "secret is nil."
57
+ end
58
+
59
+ opts[:application][:secret]
51
60
  end
52
61
 
53
62
  def rsa_encryption?
@@ -67,15 +76,15 @@ module Doorkeeper
67
76
  end
68
77
 
69
78
  def rsa_key_file
70
- OpenSSL::PKey::RSA.new(secret_key_file_open)
79
+ secret_key_file_open { |f| OpenSSL::PKey::RSA.new(f) }
71
80
  end
72
81
 
73
82
  def ecdsa_key_file
74
- OpenSSL::PKey::EC.new(secret_key_file_open)
83
+ secret_key_file_open { |f| OpenSSL::PKey::EC.new(f) }
75
84
  end
76
85
 
77
- def secret_key_file_open
78
- File.open(Doorkeeper::JWT.configuration.secret_key_path)
86
+ def secret_key_file_open(&block)
87
+ File.open(Doorkeeper::JWT.configuration.secret_key_path, &block)
79
88
  end
80
89
  end
81
90
  end
@@ -1,5 +1,5 @@
1
1
  module Doorkeeper
2
2
  module JWT
3
- VERSION = "0.1.7".freeze
3
+ VERSION = "0.1.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Warren
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.4.6
148
+ rubygems_version: 2.4.8
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: JWT token generator for Doorkeeper