omniauth-aitu-passport 0.1.24 → 0.1.27

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: 7a58e50932132dada555e296ab35d8164105768c7aed6f411315705cb13a6183
4
- data.tar.gz: 63e2743ae7099c59911bd5518e023fabda97982ab8d680285e2395aa2f755b56
3
+ metadata.gz: d936a68f0486388f148e3c1469f38e0344ca984232cb67bd7de7eadd34f43dba
4
+ data.tar.gz: 1fd811ae00e4e0eeb234c8e2960f75537b2a300fdb5fda4304b81198cac47b6d
5
5
  SHA512:
6
- metadata.gz: 1772e65d6e68a2a25c6bbae50491b0a77d5696a04f4895e4ba16a4748b0ec0e1ede16fe14a4169503f054c6b1aeefcfa622b29b8332f1e5fbec7b771c9b2f28a
7
- data.tar.gz: 4aba6961aa2168b0d80812b80b8d31b0e9a85923b09c786c904f13668af7dea2f2c358ad0eda013fb86147bf69d94f3f6d1d448f0c127da8fe27012d88eda11e
6
+ metadata.gz: 548f2d47c40d2f152e41b89cd20f4244ce70c5f27b0af1b7034218ac5797b4611e3db925115879b341d9f086ee1c99ef4e93e3141af6f880813b63ac7fc04e1f
7
+ data.tar.gz: 98e9ef21a97881eed7202c60a3c70f195ba28ef33ecf56559d034d03dcf961ad15195995588d920061c8b20a369e221fc41a6ff3ab45b25cdb947db80be1c6d0
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
- # v 0.1.24
1
+ # v 0.1.27
2
+ Changed:
3
+ - staging environment replaced with test environment
2
4
 
3
- Added:
4
- - [wallet_read, wallet] scope options, regarding to https://docs.passport.aitu.io/#operation/oauthAuth
5
5
 
6
6
  # v 0.1.22
7
7
  Added:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-aitu-passport (0.1.23)
4
+ omniauth-aitu-passport (0.1.27)
5
5
  oauth2 (~> 1.4.7)
6
6
  omniauth (~> 1)
7
7
  omniauth-oauth2 (~> 1)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module AituPassport
5
- VERSION = '0.1.24'
5
+ VERSION = '0.1.27'
6
6
  end
7
7
  end
@@ -3,6 +3,7 @@
3
3
  require 'omniauth'
4
4
  require 'oauth2'
5
5
  require 'omniauth-oauth2'
6
+ require 'jwt'
6
7
 
7
8
  module OmniAuth
8
9
  module Strategies
@@ -19,6 +20,7 @@ module OmniAuth
19
20
  }
20
21
 
21
22
  option :pkce, true
23
+ option :jwt_leeway, 60
22
24
 
23
25
  AVAILABLE_SCOPE_OPTIONS = %w[
24
26
  openid
@@ -46,6 +48,8 @@ module OmniAuth
46
48
 
47
49
  DEFAULT_SCOPE = 'openid phone'
48
50
 
51
+ ALLOWED_ISS = %w[https://passport.test.supreme-team.tech https://passport.aitu.io].freeze
52
+
49
53
  uid { raw_info['openid'] }
50
54
 
51
55
  info do
@@ -59,9 +63,31 @@ module OmniAuth
59
63
  end
60
64
 
61
65
  extra do
62
- {
63
- 'raw_info' => raw_info
64
- }
66
+ hash = {}
67
+ hash[:id_token] = access_token['id_token']
68
+ if !options[:skip_jwt] && !access_token['id_token'].nil?
69
+ decoded = ::JWT.decode(access_token['id_token'], nil, false).first
70
+
71
+ # We have to manually verify the claims because the third parameter to
72
+ # JWT.decode is false since no verification key is provided.
73
+ ::JWT::Verify.verify_claims(decoded,
74
+ verify_iss: true,
75
+ iss: ALLOWED_ISS,
76
+ verify_aud: true,
77
+ aud: options.client_id,
78
+ verify_sub: false,
79
+ verify_expiration: true,
80
+ verify_not_before: true,
81
+ verify_iat: false,
82
+ verify_jti: false,
83
+ leeway: options[:jwt_leeway])
84
+
85
+ hash[:id_info] = decoded
86
+ end
87
+ hash[:raw_info] = raw_info unless skip_info?
88
+
89
+ # returning resulting hash
90
+ hash
65
91
  end
66
92
 
67
93
  # Omniauth::Strategy
@@ -71,7 +97,7 @@ module OmniAuth
71
97
  # Raising up an error if redirect_uri is missing
72
98
  raise ArgumentError, 'Wrong options: redirect_uri option is missing.' unless options[:redirect_uri]
73
99
 
74
- options[:client_options][:site] = 'https://passport.stage.supreme-team.tech' if ENV['PASSPORT_STAGING']
100
+ options[:client_options][:site] = 'https://passport.test.supreme-team.tech' if ENV['PASSPORT_STAGING']
75
101
  end
76
102
  end
77
103
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-aitu-passport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shevchenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2