omniauth-doximity-oauth2 1.2.0.pre → 1.2.0.pre.2

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: 7a115db51c6901227e768b5d4e6b3936cece507e74e95c56e863df69ea8df6a9
4
- data.tar.gz: d271503b99bac24d5c48f2671f50d2fee7f2d76f154a6964910e567af76f8f5c
3
+ metadata.gz: 6125c48f6bde54da8c8d37acce9d03017b818c4024ba45a77eedb08dc6ced957
4
+ data.tar.gz: 6dbbfd75beab8b9e88e67d99a54bbe9a6be837f4d5ed5b0228934804ab6e58f7
5
5
  SHA512:
6
- metadata.gz: d3e64fd03c57ced3f0b77ebb95a0ef3b8d32e6907ad16d3b65da5fc314f1a4085ed7c7b0b2d6b89dadfc67a641d5693bfa71ff9b8348d3b292cb03e55ad5f04b
7
- data.tar.gz: '0208112352a8904c69b7a54c602c10f3e017881efc73f6e5e257bf9bca130288fd3438aa35bdac7f2dcd697004f077bd0fc5fc9833a1e290ba5c8d3794ab894e'
6
+ metadata.gz: 70aa3ebad66b71b82d49c798589e1cd67412853dcde60a80fe7311e3be3df646da34020e7fdc143a9742cc92c0dd08be9802a198abb95f7d816e1dffc4eec79c
7
+ data.tar.gz: 3e3ca067a61109392048de65e1e76a100e7373edc34c08633cc638282b8c0082af2909ecb35f5f74ec4d49423eabf84df96877239be4e270fb6723d8a861cd63
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- ## 1.2.0.pre - 05/05/2023
4
+ ## 1.2.0.pre.2 - 05/05/2023
5
5
  * Update mechanism for verifying RSA public keys to work on OpenSSL 3
6
6
  * Ensure state persists between initial call and on callback
7
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-doximity-oauth2 (1.2.0.pre)
4
+ omniauth-doximity-oauth2 (1.2.0.pre.2)
5
5
  activesupport
6
6
  faraday
7
7
  jwt
@@ -102,7 +102,7 @@ module OmniAuth
102
102
  keys = request_keys
103
103
 
104
104
  public_key_params = keys.find { |key| key["kid"] == header["kid"] }
105
- rsa_key = Crypto.create_rsa_key(public_key_params["n"], public_key_params["e"])
105
+ rsa_key = OmniAuth::DoximityOauth2::Crypto.create_rsa_key(public_key_params["n"], public_key_params["e"])
106
106
 
107
107
  body, = JWT.decode(token, rsa_key.public_key, true, { algorithm: header["alg"] })
108
108
  body
@@ -4,26 +4,28 @@ module Omniauth
4
4
  module DoximityOauth2
5
5
  # Static crypto methods
6
6
  class Crypto
7
- def self.create_rsa_key(n, e)
8
- data_sequence = OpenSSL::ASN1::Sequence([
9
- OpenSSL::ASN1::Integer(base64_to_long(n)),
10
- OpenSSL::ASN1::Integer(base64_to_long(e))
11
- ])
12
- asn1 = OpenSSL::ASN1::Sequence(data_sequence)
13
- OpenSSL::PKey::RSA.new(asn1.to_der)
14
- end
7
+ class << self
8
+ def create_rsa_key(n, e)
9
+ data_sequence = OpenSSL::ASN1::Sequence([
10
+ OpenSSL::ASN1::Integer(base64_to_long(n)),
11
+ OpenSSL::ASN1::Integer(base64_to_long(e))
12
+ ])
13
+ asn1 = OpenSSL::ASN1::Sequence(data_sequence)
14
+ OpenSSL::PKey::RSA.new(asn1.to_der)
15
+ end
15
16
 
16
- private
17
+ private
17
18
 
18
- def base64_to_long(data)
19
- decoded_with_padding = Base64.urlsafe_decode64(data) + Base64.decode64("==")
20
- decoded_with_padding.to_s.unpack("C*").map do |byte|
21
- byte_to_hex(byte)
22
- end.join.to_i(16)
23
- end
19
+ def base64_to_long(data)
20
+ decoded_with_padding = Base64.urlsafe_decode64(data) + Base64.decode64("==")
21
+ decoded_with_padding.to_s.unpack("C*").map do |byte|
22
+ byte_to_hex(byte)
23
+ end.join.to_i(16)
24
+ end
24
25
 
25
- def byte_to_hex(int)
26
- int < 16 ? "0#{int.to_s(16)}" : int.to_s(16)
26
+ def byte_to_hex(int)
27
+ int < 16 ? "0#{int.to_s(16)}" : int.to_s(16)
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module DoximityOauth2
5
- VERSION = "1.2.0.pre"
5
+ VERSION = "1.2.0.pre.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-doximity-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre
4
+ version: 1.2.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Harvey