omniauth-parallelmarkets 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +18 -0
- data/README.md +1 -1
- data/lib/omniauth-parallelmarkets/version.rb +1 -1
- data/lib/omniauth/strategies/parallelmarkets.rb +36 -14
- data/omniauth-parallelmarkets.gemspec +0 -1
- metadata +7 -22
- data/.rubocop.yml +0 -11
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 116a4e6f6b528976b72de3ea0fe9b1fbdb49789abf02fe1ec140596554cedbb9
|
4
|
+
data.tar.gz: a609f558e13b46498bbe870c94873846a13a33a012700d78c261c76826995aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd138b8aab041a68b18601f66602b5b5753f5f7b820c1def738a024da32471ab72d81711a18ce53d64e4bc421e52d8d1e2d5e4167d52071551f4463d08aa3bb1
|
7
|
+
data.tar.gz: 5487cb23b4ba7b1e4213634ac645b3525f894dfe4e693c7cb9414448d892a6cf400d5f9968db5c48c7b435723635b2691b49ee0347db7110c56694d38094ebba
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Run Tests
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: Checkout
|
11
|
+
uses: actions/checkout@master
|
12
|
+
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: '3.0.1'
|
16
|
+
bundler-cache: true
|
17
|
+
|
18
|
+
- run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/omniauth-parallelmarkets.svg)](https://badge.fury.io/rb/omniauth-parallelmarkets)
|
2
|
-
[![
|
2
|
+
[![Tests](https://github.com/parallel-markets/omniauth-parallelmarkets/actions/workflows/ci.yml/badge.svg)](https://github.com/parallel-markets/omniauth-parallelmarkets/actions/workflows/ci.yml)
|
3
3
|
|
4
4
|
# OmniAuth ParallelMarkets
|
5
5
|
|
@@ -9,26 +9,26 @@ module OmniAuth
|
|
9
9
|
site: 'https://api.parallelmarkets.com',
|
10
10
|
authorize_url: '/v1/oauth/authorize',
|
11
11
|
token_url: '/v1/oauth/token'
|
12
|
-
option :authorize_options, %i[scope force_accreditation_check]
|
12
|
+
option :authorize_options, %i[scope force_accreditation_check force_identity_check identity_claim_override_id]
|
13
13
|
|
14
14
|
uid { raw_info['id'] }
|
15
15
|
|
16
|
-
info
|
17
|
-
{
|
18
|
-
name: profile['name'] || "#{profile['first_name']} #{profile['last_name']}",
|
19
|
-
first_name: profile['first_name'],
|
20
|
-
last_name: profile['last_name'],
|
21
|
-
email: profile['email']
|
22
|
-
}
|
23
|
-
end
|
16
|
+
info { to_contact_details(profile) }
|
24
17
|
|
25
18
|
extra do
|
26
19
|
{
|
27
|
-
|
20
|
+
authorize_scopes: authorize_scopes,
|
21
|
+
# from /api/v1/me
|
28
22
|
business_type: profile['business_type'],
|
23
|
+
primary_contact: to_contact_details(profile['primary_contact']),
|
24
|
+
raw_info: raw_info,
|
29
25
|
type: raw_info['type'],
|
30
26
|
user_id: raw_info['user_id'],
|
31
|
-
|
27
|
+
user_profile: to_contact_details(user_profile),
|
28
|
+
user_providing_for: raw_info['user_providing_for'],
|
29
|
+
# from /api/v1/accreditations
|
30
|
+
accreditations: accreditations,
|
31
|
+
indicated_unaccredited: raw_accreditations['indicated_unaccredited']
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -45,20 +45,42 @@ module OmniAuth
|
|
45
45
|
options[:redirect_uri] || (full_host + script_name + callback_path)
|
46
46
|
end
|
47
47
|
|
48
|
+
def scope?(single_scope)
|
49
|
+
authorize_scopes.include?(single_scope.to_s)
|
50
|
+
end
|
51
|
+
|
52
|
+
# if given ?scope query parameter, use that. otherwise, use server-side provider configuration
|
53
|
+
def authorize_scopes
|
54
|
+
@authorize_scopes ||= (env['omniauth.params']['scope'] || authorize_params['scope']).split(' ')
|
55
|
+
end
|
56
|
+
|
48
57
|
def raw_info
|
49
|
-
@raw_info ||= access_token.get('/v1/me').parsed
|
58
|
+
@raw_info ||= scope?(:profile) ? access_token.get('/v1/me').parsed : {}
|
50
59
|
end
|
51
60
|
|
52
61
|
def profile
|
53
62
|
@profile ||= raw_info.fetch('profile', {})
|
54
63
|
end
|
55
64
|
|
65
|
+
def user_profile
|
66
|
+
@user_profile ||= raw_info.fetch('user_profile', {})
|
67
|
+
end
|
68
|
+
|
56
69
|
def raw_accreditations
|
57
|
-
@raw_accreditations ||= access_token.get('/v1/accreditations').parsed
|
70
|
+
@raw_accreditations ||= scope?(:accreditation_status) ? access_token.get('/v1/accreditations').parsed : {}
|
58
71
|
end
|
59
72
|
|
60
73
|
def accreditations
|
61
|
-
raw_accreditations
|
74
|
+
@accreditations ||= raw_accreditations.fetch('accreditations', [])
|
75
|
+
end
|
76
|
+
|
77
|
+
def to_contact_details(contact)
|
78
|
+
(contact.nil? || contact.empty?) ? {} : {
|
79
|
+
name: contact['name'] || "#{contact['first_name']} #{contact['last_name']}",
|
80
|
+
first_name: contact['first_name'],
|
81
|
+
last_name: contact['last_name'],
|
82
|
+
email: contact['email']
|
83
|
+
}
|
62
84
|
end
|
63
85
|
end
|
64
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-parallelmarkets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Muller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Parallel Markets OAuth strategy for OmniAuth.
|
70
56
|
email:
|
71
57
|
- bamuller@gmail.com
|
@@ -73,10 +59,9 @@ executables: []
|
|
73
59
|
extensions: []
|
74
60
|
extra_rdoc_files: []
|
75
61
|
files:
|
62
|
+
- ".github/workflows/ci.yml"
|
76
63
|
- ".gitignore"
|
77
64
|
- ".rspec"
|
78
|
-
- ".rubocop.yml"
|
79
|
-
- ".travis.yml"
|
80
65
|
- Gemfile
|
81
66
|
- LICENSE
|
82
67
|
- README.md
|
@@ -89,7 +74,7 @@ homepage: https://github.com/parallel-markets/omniauth-parallelmarkets
|
|
89
74
|
licenses:
|
90
75
|
- MIT
|
91
76
|
metadata: {}
|
92
|
-
post_install_message:
|
77
|
+
post_install_message:
|
93
78
|
rdoc_options: []
|
94
79
|
require_paths:
|
95
80
|
- lib
|
@@ -104,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
89
|
- !ruby/object:Gem::Version
|
105
90
|
version: '0'
|
106
91
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
108
|
-
signing_key:
|
92
|
+
rubygems_version: 3.1.2
|
93
|
+
signing_key:
|
109
94
|
specification_version: 4
|
110
95
|
summary: Parallel Markets OAuth strategy for OmniAuth
|
111
96
|
test_files: []
|
data/.rubocop.yml
DELETED