omniauth-aitu-passport 0.1.14 → 0.1.23
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 +22 -3
- 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: 98d393721a073d223529459f4764f1e145c83b85e7913b60b52d9f57eee582e7
|
4
|
+
data.tar.gz: 6925498fdfe8e4be681c6c25813c5e6a7a6a225100baf44eeb67bd10c3408d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66df465f4ebdec49db3a701efa69161687c3667a147991307a67014d331845d6f79b6c4bae272a66e7d02f7e2409d62d7e94c1707d0889a5033005e70ddc9b08
|
7
|
+
data.tar.gz: 8b98ac5e8e213fe9c23a8d190fdf6252ff7eb11e44d290b6d35b99385c86b3377a6a28998ebfa9a21679ba44c79a05e854d5ddd3ca5fd2dfcfc3f67157fcc05b
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,40 @@
|
|
1
|
-
# v 0.1.
|
1
|
+
# v 0.1.23
|
2
2
|
|
3
|
-
Added:
|
4
|
-
-
|
3
|
+
Added:
|
4
|
+
- wallet_read scope option, 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,7 @@ module OmniAuth
|
|
39
40
|
identification_document_ocr
|
40
41
|
identification_document_mrz
|
41
42
|
idpc_verification
|
43
|
+
wallet_read
|
42
44
|
].freeze
|
43
45
|
|
44
46
|
DEFAULT_SCOPE = 'openid phone'
|
@@ -68,7 +70,7 @@ module OmniAuth
|
|
68
70
|
# Raising up an error if redirect_uri is missing
|
69
71
|
raise ArgumentError, 'Wrong options: redirect_uri option is missing.' unless options[:redirect_uri]
|
70
72
|
|
71
|
-
options[:
|
73
|
+
options[:client_options][:site] = 'https://passport.stage.supreme-team.tech' if ENV['PASSPORT_STAGING']
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -76,6 +78,8 @@ module OmniAuth
|
|
76
78
|
def authorize_params
|
77
79
|
super.tap do |params|
|
78
80
|
params[:scope] = filter_scope(params)
|
81
|
+
params[:redirect_uri] = options[:redirect_uri]
|
82
|
+
params[:session_id] = get_session_id
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
@@ -85,6 +89,21 @@ module OmniAuth
|
|
85
89
|
|
86
90
|
private
|
87
91
|
|
92
|
+
def get_session_id
|
93
|
+
params = ::OAuth2::Authenticator.new(client.id, client.secret, client.options[:auth_scheme]).apply({})
|
94
|
+
res = client.request(:post, session_url, params)
|
95
|
+
case res.status
|
96
|
+
when 200
|
97
|
+
JSON.parse(res.body).dig('sessionId')
|
98
|
+
else
|
99
|
+
raise NoSessionError, 'No session ID received, sorry.'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def session_url
|
104
|
+
options[:client_options][:site] + options[:client_options][:session_url]
|
105
|
+
end
|
106
|
+
|
88
107
|
def filter_scope(params)
|
89
108
|
return DEFAULT_SCOPE unless params[:scope]
|
90
109
|
|
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.23
|
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__)
|