omniauth-doximity-oauth2 1.1.0 → 1.2.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/omniauth/strategies/doximity_oauth2.rb +6 -7
- data/lib/omniauth-doximity-oauth2/crypto.rb +32 -0
- data/lib/omniauth-doximity-oauth2/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6125c48f6bde54da8c8d37acce9d03017b818c4024ba45a77eedb08dc6ced957
|
4
|
+
data.tar.gz: 6dbbfd75beab8b9e88e67d99a54bbe9a6be837f4d5ed5b0228934804ab6e58f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70aa3ebad66b71b82d49c798589e1cd67412853dcde60a80fe7311e3be3df646da34020e7fdc143a9742cc92c0dd08be9802a198abb95f7d816e1dffc4eec79c
|
7
|
+
data.tar.gz: 3e3ca067a61109392048de65e1e76a100e7373edc34c08633cc638282b8c0082af2909ecb35f5f74ec4d49423eabf84df96877239be4e270fb6723d8a861cd63
|
data/.github/CODEOWNERS
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 1.2.0.pre.2 - 05/05/2023
|
5
|
+
* Update mechanism for verifying RSA public keys to work on OpenSSL 3
|
6
|
+
* Ensure state persists between initial call and on callback
|
7
|
+
|
4
8
|
## 1.1.0 - 06/13/2022
|
5
9
|
* Add "prompt" parameter to be persisted on request, allowing for silent authentication (among other things)
|
6
10
|
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "omniauth/strategies/oauth2"
|
4
|
+
require "omniauth-doximity-oauth2/crypto"
|
4
5
|
require "omniauth-doximity-oauth2/errors"
|
5
6
|
require "active_support/core_ext/hash/indifferent_access"
|
6
7
|
require "uri"
|
@@ -74,13 +75,16 @@ module OmniAuth
|
|
74
75
|
@raw_credential_info ||= access_token.to_hash.with_indifferent_access
|
75
76
|
end
|
76
77
|
|
77
|
-
def authorize_params
|
78
|
+
def authorize_params # rubocop:disable Metrics/AbcSize
|
78
79
|
super.tap do |params|
|
79
80
|
options[:authorize_options].each do |v|
|
80
81
|
params[v.to_sym] = request.params[v.to_s] if request.params[v.to_s]
|
81
82
|
end
|
82
83
|
|
83
84
|
params[:scope] = get_scope(params)
|
85
|
+
|
86
|
+
# Ensure state is persisted
|
87
|
+
session['omniauth.state'] = params[:state] if params[:state]
|
84
88
|
end
|
85
89
|
end
|
86
90
|
|
@@ -98,7 +102,7 @@ module OmniAuth
|
|
98
102
|
keys = request_keys
|
99
103
|
|
100
104
|
public_key_params = keys.find { |key| key["kid"] == header["kid"] }
|
101
|
-
rsa_key = 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"])
|
102
106
|
|
103
107
|
body, = JWT.decode(token, rsa_key.public_key, true, { algorithm: header["alg"] })
|
104
108
|
body
|
@@ -125,11 +129,6 @@ module OmniAuth
|
|
125
129
|
|
126
130
|
MultiJson.load(response.body)["keys"]
|
127
131
|
end
|
128
|
-
|
129
|
-
def create_rsa_key(n, e)
|
130
|
-
key = OpenSSL::PKey::RSA.new
|
131
|
-
key.set_key(OpenSSL::BN.new(Base64.urlsafe_decode64(n), 2), OpenSSL::BN.new(Base64.urlsafe_decode64(e), 2), nil)
|
132
|
-
end
|
133
132
|
end
|
134
133
|
end
|
135
134
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omniauth
|
4
|
+
module DoximityOauth2
|
5
|
+
# Static crypto methods
|
6
|
+
class Crypto
|
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
|
16
|
+
|
17
|
+
private
|
18
|
+
|
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
|
25
|
+
|
26
|
+
def byte_to_hex(int)
|
27
|
+
int < 16 ? "0#{int.to_s(16)}" : int.to_s(16)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-doximity-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- README.md
|
200
200
|
- Rakefile
|
201
201
|
- lib/omniauth-doximity-oauth2.rb
|
202
|
+
- lib/omniauth-doximity-oauth2/crypto.rb
|
202
203
|
- lib/omniauth-doximity-oauth2/errors.rb
|
203
204
|
- lib/omniauth-doximity-oauth2/version.rb
|
204
205
|
- lib/omniauth/strategies/doximity_oauth2.rb
|
@@ -264,9 +265,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
264
265
|
version: 2.5.0
|
265
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
266
267
|
requirements:
|
267
|
-
- - "
|
268
|
+
- - ">"
|
268
269
|
- !ruby/object:Gem::Version
|
269
|
-
version:
|
270
|
+
version: 1.3.1
|
270
271
|
requirements: []
|
271
272
|
rubygems_version: 3.3.11
|
272
273
|
signing_key:
|