activerecord_aad 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 132d1e6ee2a22807d770626e05855f921d08c9939b34ef13ba7d9bbb5cbfaf9d
4
- data.tar.gz: a8dade4efc62264cd488b24c67b8d346d019743028b1b2df9103a8764aadfb76
3
+ metadata.gz: 46c5ca1c2164940d279cb8385452c3001190c281f07319458c83ecb04ce28066
4
+ data.tar.gz: b5a844c77d30b17a00cd62baffb0f4538a124b667f2d36e52699afff60ae6e32
5
5
  SHA512:
6
- metadata.gz: 997b7ff430e1944a6813b0c416dd641b09b37c5f39a8909b8e2d0188db457a9d14e682238037572fc03dcbb0fb31249625c1b678f5f6b1c25138904715cb55b7
7
- data.tar.gz: fdbf4bd7056745fa874476260d141b89a8641954b495d167940e840152604ddca0f82c2cb69a99859929502e493059fb891c46bc6dcb4336232b452b649dbe1e
6
+ metadata.gz: 9ee266dbfbfd11c8717e6ab3d6c1f8eeabd24d610b8d810be69c9dad6b044d30ba6da238e8ef99bb35165e50ed7d53c5ada2f2fb97274bb935c06ac3184e39ac
7
+ data.tar.gz: 2618f415adb4b784faf3129a563518253e21132e93cef7380f497557f9da3d00b517483930d47e12a0224e998ffe638009857309096622d970162bb3e8f3e68f
@@ -4,7 +4,7 @@ $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'activerecord_aad'
7
- s.version = '0.2.0'
7
+ s.version = '0.3.0'
8
8
  s.authors = ['Taylor Yelverton']
9
9
  s.email = 'rubygems@yelvert.io'
10
10
  s.homepage = 'https://github.com/ComplyMD/activerecord_aad'
@@ -7,12 +7,12 @@ module Azure
7
7
  module HashConfig
8
8
 
9
9
  def configuration_hash
10
- hash = super.dup
10
+ hash = super.dup.with_indifferent_access
11
11
  if hash[:azure_managed_identity].present?
12
- @managed_identity_manager ||= ManagedIdentityManager.new(hash)
13
- @managed_identity_manager.apply
12
+ @managed_identity_manager ||= ManagedIdentityManager.new(hash[:azure_managed_identity])
13
+ @managed_identity_manager.apply hash
14
14
  end
15
- hash.symbolize_keys!.freeze
15
+ hash.freeze
16
16
  hash
17
17
  end
18
18
 
@@ -21,19 +21,17 @@ module Azure
21
21
  class ManagedIdentityManager
22
22
  URL = 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fossrdbms-aad.database.windows.net'
23
23
 
24
- attr_reader :config, :url
24
+ attr_reader :client_id, :url
25
25
 
26
- def initialize(conf)
27
- raise "ActiveRecordAAD: invalid config: `#{conf}`" unless conf.is_a?(Hash)
28
- @config = conf.with_indifferent_access
29
- @client_id = config[:azure_managed_identity]
26
+ def initialize(cid)
27
+ @client_id = cid
30
28
  @url = URL
31
- @url += "&client_id=#{@client_id}" if @client_id.present?
29
+ @url += "&client_id=#{@client_id}"
32
30
  end
33
31
 
34
- def apply(hash)
35
- hash[:password] = access_token
36
- hash[:enable_cleartext_plugin] = true if hash[:adapter] == 'mysql2'
32
+ def apply(config)
33
+ config[:password] = access_token
34
+ config[:enable_cleartext_plugin] = true if config[:adapter] == 'mysql2'
37
35
  end
38
36
 
39
37
  def access_token
@@ -55,4 +53,4 @@ module Azure
55
53
 
56
54
  end
57
55
  end
58
- end
56
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_aad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Yelverton