doorkeeper-jwt 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c95e333012ef38f81ceee7a5a2c431d33ecbf1d
4
- data.tar.gz: 2e805901112a1968d5c7e21eab8db7a5f5187aa3
3
+ metadata.gz: a943aa0b9dc65189852d3ab4584371c3254c2ee1
4
+ data.tar.gz: 2a4f967cbef940a5d3fb5248b419d48adcdb324c
5
5
  SHA512:
6
- metadata.gz: a14d4bd9c67834b5a2d1384c8140396cc9a3ac261aed4d69278e4b52cfd5c95a0717f87d84af064ca46eaf8e22004e6c7e6127b84ae4335229f33cd0f7283685
7
- data.tar.gz: 0ebb2d51b8c517b1de6b13afcf403fdfdaaa3d72692a43abf8155c459b97457d9d1f2cfe6cb2c0cd882ccd283a8bd3d6cac7bc51280919f6b8667115580b5f2e
6
+ metadata.gz: c15efeba186db245f32174ba86e8eec0e8939f7534d42e19cc05230a20ba9269994c17ecaab588d33cd32a6c77bab5386ec5146111d48430aa1443ce190403c8
7
+ data.tar.gz: bb1c0da134318b6787b6571ec9c34b269095c0a9f5421d3186ed24ce3ba6c27e6f6494be83dbcca8d90632bcafea06db852ae80311c863e252aa8141bbb6c5d9
@@ -1,3 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.1
4
+ addons:
5
+ code_climate:
6
+ repo_token: a44faab4cd18aeb4898a374736ac95bbb1de26015e9f53d5c809109e11df1149
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'coveralls', require: false
7
+ gem "codeclimate-test-reporter", group: :test, require: nil
File without changes
data/bin/setup CHANGED
File without changes
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "jwt", "~> 1.4", ">= 1.4.1"
22
+ spec.add_dependency "jwt", "~> 1.5.2", ">= 1.5.2"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.8", ">= 1.8"
25
25
  spec.add_development_dependency "rake", "~> 10.0", ">= 10.0"
@@ -4,44 +4,66 @@ require 'jwt'
4
4
 
5
5
  module Doorkeeper
6
6
  module JWT
7
- def self.generate(opts = {})
8
- ::JWT.encode(
9
- token_payload(opts),
10
- secret_key,
11
- encryption_method
12
- )
13
- end
7
+ class << self
8
+ def generate(opts = {})
9
+ ::JWT.encode(
10
+ token_payload(opts),
11
+ secret_key,
12
+ encryption_method
13
+ )
14
+ end
14
15
 
15
- private
16
+ private
16
17
 
17
- def self.token_payload(opts = {})
18
- Doorkeeper::JWT.configuration.token_payload.call opts
19
- end
18
+ def token_payload(opts = {})
19
+ Doorkeeper::JWT.configuration.token_payload.call opts
20
+ end
20
21
 
21
- def self.secret_key
22
- return secret_key_file if !secret_key_file.nil?
23
- return rsa_key if rsa_encryption?
24
- Doorkeeper::JWT.configuration.secret_key
25
- end
22
+ def secret_key
23
+ return secret_key_file unless secret_key_file.nil?
24
+ return rsa_key if rsa_encryption?
25
+ return ecdsa_key if ecdsa_encryption?
26
+ Doorkeeper::JWT.configuration.secret_key
27
+ end
26
28
 
27
- def self.secret_key_file
28
- return nil if Doorkeeper::JWT.configuration.secret_key_path.nil?
29
- OpenSSL::PKey::RSA.new(
30
- File.open(Doorkeeper::JWT.configuration.secret_key_path)
31
- )
32
- end
29
+ def secret_key_file
30
+ return nil if Doorkeeper::JWT.configuration.secret_key_path.nil?
31
+ return rsa_key_file if rsa_encryption?
32
+ return ecdsa_key_file if ecdsa_encryption?
33
+ end
33
34
 
34
- def self.encryption_method
35
- return nil unless Doorkeeper::JWT.configuration.encryption_method
36
- Doorkeeper::JWT.configuration.encryption_method.to_s.upcase
37
- end
35
+ def encryption_method
36
+ return nil unless Doorkeeper::JWT.configuration.encryption_method
37
+ Doorkeeper::JWT.configuration.encryption_method.to_s.upcase
38
+ end
38
39
 
39
- def self.rsa_encryption?
40
- /RS\d{3}/ =~ encryption_method
41
- end
40
+ def rsa_encryption?
41
+ /RS\d{3}/ =~ encryption_method
42
+ end
42
43
 
43
- def self.rsa_key
44
- OpenSSL::PKey::RSA.new(Doorkeeper::JWT.configuration.secret_key)
44
+ def ecdsa_encryption?
45
+ /ES\d{3}/ =~ encryption_method
46
+ end
47
+
48
+ def rsa_key
49
+ OpenSSL::PKey::RSA.new(Doorkeeper::JWT.configuration.secret_key)
50
+ end
51
+
52
+ def ecdsa_key
53
+ OpenSSL::PKey::EC.new(Doorkeeper::JWT.configuration.secret_key)
54
+ end
55
+
56
+ def rsa_key_file
57
+ OpenSSL::PKey::RSA.new(secret_key_file_open)
58
+ end
59
+
60
+ def ecdsa_key_file
61
+ OpenSSL::PKey::EC.new(secret_key_file_open)
62
+ end
63
+
64
+ def secret_key_file_open
65
+ File.open(Doorkeeper::JWT.configuration.secret_key_path)
66
+ end
45
67
  end
46
68
  end
47
69
  end
@@ -1,5 +1,5 @@
1
1
  module Doorkeeper
2
2
  module JWT
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Warren
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: 1.5.2
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.1
22
+ version: 1.5.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.4'
29
+ version: 1.5.2
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.4.1
32
+ version: 1.5.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement