omniauth-aitu-passport 0.1.19 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -6
- data/Gemfile.lock +1 -1
- data/README.md +16 -4
- data/lib/omniauth/aitu_passport/version.rb +1 -1
- data/lib/omniauth/strategies/aitu_passport.rb +23 -2
- metadata +2 -4
- data/bin/console +0 -15
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a58e50932132dada555e296ab35d8164105768c7aed6f411315705cb13a6183
|
4
|
+
data.tar.gz: 63e2743ae7099c59911bd5518e023fabda97982ab8d680285e2395aa2f755b56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1772e65d6e68a2a25c6bbae50491b0a77d5696a04f4895e4ba16a4748b0ec0e1ede16fe14a4169503f054c6b1aeefcfa622b29b8332f1e5fbec7b771c9b2f28a
|
7
|
+
data.tar.gz: 4aba6961aa2168b0d80812b80b8d31b0e9a85923b09c786c904f13668af7dea2f2c358ad0eda013fb86147bf69d94f3f6d1d448f0c127da8fe27012d88eda11e
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,40 @@
|
|
1
|
-
# v 0.1.
|
1
|
+
# v 0.1.24
|
2
2
|
|
3
|
-
Added:
|
4
|
-
-
|
3
|
+
Added:
|
4
|
+
- [wallet_read, wallet] scope options, regarding to https://docs.passport.aitu.io/#operation/oauthAuth
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
# v 0.1.22
|
7
|
+
Added:
|
8
|
+
- session_id added to auth link according to
|
9
|
+
https://docs.passport.aitu.io/#tag/Poluchenie-identifikatora-oauth-sessii
|
10
|
+
- PASSPORT_STAGING env option
|
11
|
+
- token_url moved to /api/v1
|
12
|
+
|
13
|
+
Removed:
|
14
|
+
- setup binaries
|
15
|
+
|
16
|
+
# v 0.1.9
|
17
|
+
Fixed:
|
18
|
+
- possible NoMethod error in guard clause
|
19
|
+
|
20
|
+
Added:
|
21
|
+
- Base test cases
|
22
|
+
- Rubocop inspections
|
8
23
|
|
9
24
|
# v 0.1.8
|
10
25
|
|
11
26
|
Added:
|
12
27
|
- redirect_uri accepted once in :options
|
13
28
|
|
29
|
+
Removed:
|
30
|
+
- None
|
31
|
+
|
32
|
+
|
33
|
+
# v 0.1.6
|
34
|
+
|
35
|
+
Added:
|
36
|
+
- Scope filtered to avoid malformed_scope errors
|
37
|
+
|
14
38
|
Removed:
|
15
|
-
- None
|
39
|
+
- None
|
40
|
+
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -43,12 +43,15 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
43
43
|
provider :aitu_passport,
|
44
44
|
ENV['PASSPORT_KEY'],
|
45
45
|
ENV['PASSPORT_SECRET'],
|
46
|
-
{
|
46
|
+
{
|
47
47
|
scope: 'phone first_name middle_name last_name gender openid',
|
48
48
|
response_type: 'code',
|
49
49
|
client_id: ENV['PASSPORT_KEY'],
|
50
50
|
provider_ignores_state: Rails.env == 'production' ? false : true,
|
51
|
-
redirect_uri: ENV['PASSPORT_REDIRECT_URI']
|
51
|
+
redirect_uri: ENV['PASSPORT_REDIRECT_URI'],
|
52
|
+
token_params: {
|
53
|
+
redirect_uri: ENV['PASSPORT_REDIRECT_URI']
|
54
|
+
}
|
52
55
|
}
|
53
56
|
end
|
54
57
|
|
@@ -57,6 +60,17 @@ OmniAuth.config.logger = Rails.logger
|
|
57
60
|
```
|
58
61
|
using the keys you receive and URI you provided when registered the app
|
59
62
|
|
63
|
+
Please note :redirect_uri param under :token_params is mandatory option.
|
64
|
+
|
65
|
+
Also, you can use
|
66
|
+
|
67
|
+
```yaml
|
68
|
+
ENV['PASSPORT_STAGING']: true
|
69
|
+
```
|
70
|
+
|
71
|
+
option in your environment to send auth requests to staging AituPassport server,
|
72
|
+
e.g. https://passport.stage.supreme-team.tech
|
73
|
+
|
60
74
|
4. Use it in your sessions controller on your own, assuming the following envs to store the data you need
|
61
75
|
|
62
76
|
```ruby
|
@@ -70,8 +84,6 @@ using the keys you receive and URI you provided when registered the app
|
|
70
84
|
|
71
85
|
## Development
|
72
86
|
|
73
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
74
|
-
|
75
87
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
76
88
|
|
77
89
|
## Contributing
|
@@ -12,12 +12,13 @@ module OmniAuth
|
|
12
12
|
|
13
13
|
option :client_options, {
|
14
14
|
site: 'https://passport.aitu.io',
|
15
|
-
token_url: '/
|
15
|
+
token_url: '/api/v1/oauth/token',
|
16
16
|
authorize_url: '/oauth2/auth',
|
17
|
+
session_url: '/api/v1/oauth/session',
|
17
18
|
auth_scheme: :basic_auth
|
18
19
|
}
|
19
20
|
|
20
|
-
option :pkce,
|
21
|
+
option :pkce, true
|
21
22
|
|
22
23
|
AVAILABLE_SCOPE_OPTIONS = %w[
|
23
24
|
openid
|
@@ -39,6 +40,8 @@ module OmniAuth
|
|
39
40
|
identification_document_ocr
|
40
41
|
identification_document_mrz
|
41
42
|
idpc_verification
|
43
|
+
wallet_read
|
44
|
+
wallet
|
42
45
|
].freeze
|
43
46
|
|
44
47
|
DEFAULT_SCOPE = 'openid phone'
|
@@ -67,6 +70,8 @@ module OmniAuth
|
|
67
70
|
super.tap do
|
68
71
|
# Raising up an error if redirect_uri is missing
|
69
72
|
raise ArgumentError, 'Wrong options: redirect_uri option is missing.' unless options[:redirect_uri]
|
73
|
+
|
74
|
+
options[:client_options][:site] = 'https://passport.stage.supreme-team.tech' if ENV['PASSPORT_STAGING']
|
70
75
|
end
|
71
76
|
end
|
72
77
|
|
@@ -75,6 +80,7 @@ module OmniAuth
|
|
75
80
|
super.tap do |params|
|
76
81
|
params[:scope] = filter_scope(params)
|
77
82
|
params[:redirect_uri] = options[:redirect_uri]
|
83
|
+
params[:session_id] = get_session_id
|
78
84
|
end
|
79
85
|
end
|
80
86
|
|
@@ -84,6 +90,21 @@ module OmniAuth
|
|
84
90
|
|
85
91
|
private
|
86
92
|
|
93
|
+
def get_session_id
|
94
|
+
params = ::OAuth2::Authenticator.new(client.id, client.secret, client.options[:auth_scheme]).apply({})
|
95
|
+
res = client.request(:post, session_url, params)
|
96
|
+
case res.status
|
97
|
+
when 200
|
98
|
+
JSON.parse(res.body).dig('sessionId')
|
99
|
+
else
|
100
|
+
raise NoSessionError, 'No session ID received, sorry.'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def session_url
|
105
|
+
options[:client_options][:site] + options[:client_options][:session_url]
|
106
|
+
end
|
107
|
+
|
87
108
|
def filter_scope(params)
|
88
109
|
return DEFAULT_SCOPE unless params[:scope]
|
89
110
|
|
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.
|
4
|
+
version: 0.1.24
|
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-
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -112,8 +112,6 @@ files:
|
|
112
112
|
- LICENSE.txt
|
113
113
|
- README.md
|
114
114
|
- Rakefile
|
115
|
-
- bin/console
|
116
|
-
- bin/setup
|
117
115
|
- lib/omniauth-aitu-passport.rb
|
118
116
|
- lib/omniauth/aitu_passport.rb
|
119
117
|
- lib/omniauth/aitu_passport/version.rb
|
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'omniauth/aitu/passport'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|