sync_attr_with_auth0 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sync_attr_with_auth0/auth0.rb +7 -32
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48a0b5291c5f98b38c0594e1b98b5d062a4cc2b093286f9bf412af23f6eaf14
|
4
|
+
data.tar.gz: 8b502d146deada30410ddecf3461ef396b8439583c529105d22edfff5c2f0f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a888abb513aef90ff0fc6d2c511744445446e56d8fbbebe70296fbef5d6c26075ad52acb0b46cd7a7ff7d2cc502580f376da00e4c053e5d2f928508d61fc0f46
|
7
|
+
data.tar.gz: 481c026fb76261e0520c62d5a8db1a1b63a1fe7e2777daf71e27790ac94035ef7c117741304aec1562f9ecd868f2b17710731f52941c301ff6a3eeef5047b565
|
@@ -5,52 +5,27 @@ module SyncAttrWithAuth0
|
|
5
5
|
require "auth0"
|
6
6
|
require "uuidtools"
|
7
7
|
|
8
|
-
def self.create_auth0_jwt(global_client_id: ENV['AUTH0_GLOBAL_CLIENT_ID'], global_client_secret: ENV['AUTH0_GLOBAL_CLIENT_SECRET'])
|
9
|
-
payload = {
|
10
|
-
'aud' => global_client_id,
|
11
|
-
'scopes' => {
|
12
|
-
'users' => {
|
13
|
-
'actions' => ['create', 'update', 'read']
|
14
|
-
}
|
15
|
-
},
|
16
|
-
'iat' => Time.now.to_i,
|
17
|
-
'jti' => UUIDTools::UUID.random_create.to_s
|
18
|
-
}
|
19
|
-
|
20
|
-
jwt = JWT.encode(payload, JWT::Base64.url_decode(global_client_secret), 'HS256', { typ: 'JWT' })
|
21
|
-
|
22
|
-
return jwt
|
23
|
-
end # ::create_auth0_jwt
|
24
|
-
|
25
|
-
|
26
8
|
def self.create_auth0_client(
|
27
9
|
api_version: 2,
|
28
10
|
config: SyncAttrWithAuth0.configuration
|
29
11
|
)
|
30
12
|
validate_auth0_config_for_api(api_version, config: config)
|
31
13
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
auth0 = Auth0Client.new(api_version: 2, access_token: jwt, namespace: config.auth0_namespace)
|
38
|
-
end
|
14
|
+
auth0 = Auth0Client.new(
|
15
|
+
client_id: config.auth0_client_id,
|
16
|
+
client_secret: config.auth0_client_secret,
|
17
|
+
domain: config.auth0_namespace
|
18
|
+
)
|
39
19
|
|
40
20
|
return auth0
|
41
21
|
end # ::create_auth0_client
|
42
22
|
|
43
23
|
|
44
|
-
def self.validate_auth0_config_for_api(api_version, config: SyncAttrWithAuth0.configuration)
|
24
|
+
def self.validate_auth0_config_for_api(api_version=2, config: SyncAttrWithAuth0.configuration)
|
45
25
|
settings_to_validate = []
|
46
26
|
invalid_settings = []
|
47
27
|
|
48
|
-
|
49
|
-
when 1
|
50
|
-
settings_to_validate = [:auth0_client_id, :auth0_client_secret, :auth0_namespace]
|
51
|
-
when 2
|
52
|
-
settings_to_validate = [:auth0_global_client_id, :auth0_global_client_secret, :auth0_namespace]
|
53
|
-
end
|
28
|
+
settings_to_validate = [:auth0_client_id, :auth0_client_secret, :auth0_namespace]
|
54
29
|
|
55
30
|
settings_to_validate.each do |setting_name|
|
56
31
|
unless config.send(setting_name)
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sync_attr_with_auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick McGraw
|
8
8
|
- Mike Oliver
|
9
|
+
- Eric Anderson
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
- !ruby/object:Gem::Version
|
170
171
|
version: '0'
|
171
172
|
requirements: []
|
172
|
-
rubygems_version: 3.4
|
173
|
+
rubygems_version: 3.1.4
|
173
174
|
signing_key:
|
174
175
|
specification_version: 4
|
175
176
|
summary: Synchronize attributes on a local ActiveRecord user model with the user metadata
|