sync_attr_with_auth0 0.2.7 → 0.2.9

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: 78b6cc16ee90ef4923134f94be42fd6f9f5507a04f76855d53fbaed46d6f780f
4
- data.tar.gz: 07ac9b9cc8ee2e07a21bae95964a082e5c2a6fd5bc8db63e3721b97b2d2a8e6e
3
+ metadata.gz: a48a0b5291c5f98b38c0594e1b98b5d062a4cc2b093286f9bf412af23f6eaf14
4
+ data.tar.gz: 8b502d146deada30410ddecf3461ef396b8439583c529105d22edfff5c2f0f93
5
5
  SHA512:
6
- metadata.gz: '01239ff7161e9a1f6787b7e41161c9edf354463168af54cd941f5ede9172cf68ed4ad053edeea662e2411381d696362c8e014521d9ea63b056fec57837f8cfea'
7
- data.tar.gz: '09dba8dcf96b0b8dd28bec491bb372ded1d53f426837e664b5d462aaf9ea524e301b22009eccb86af16c38bb67d8bb3503e2a2f3340d9a90e96a147fd4e5eb34'
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
- case api_version
33
- when 1
34
- auth0 = Auth0Client.new(client_id: config.auth0_client_id, client_secret: config.auth0_client_secret, namespace: config.auth0_namespace)
35
- when 2
36
- jwt = SyncAttrWithAuth0::Auth0.create_auth0_jwt(global_client_id: config.auth0_global_client_id, global_client_secret: config.auth0_global_client_secret)
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
- case api_version
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.7
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.19
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