uc3-dmp-provenance 0.0.7 → 0.0.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: 9eff1f267cb9c78a1166b07446290eb85bdb3ad3130b6e18814b9b02451623d0
4
- data.tar.gz: b5152c9c639fdc1019fbaac216cd63a63b3a17b54f545369c373469723d02db4
3
+ metadata.gz: 8b248054cb3c84cd6befad733c0239ca005216354f165e512bf09660850f894c
4
+ data.tar.gz: 24596ac4f42da2dcbc859e9f58d790d2ea8eafec1691eba9711c20ecdfc9bfca
5
5
  SHA512:
6
- metadata.gz: b1959b822a8d88264f52a30ab46f5492db57a39946692a479a9e3c991f75b71f617b885b4b4b13007a3feebe00ca566797e77c0981196997262ba5fec0970827
7
- data.tar.gz: 00b11fd0b85e39f0f836a685569877624334eabcec095b1198eacf73e6eaea87eb5783fac699c3d6d7586db6d200f30f13600e978b850742956a80b326ec0b16
6
+ metadata.gz: 15195f0efcc76a6632ad521a182eb2d9e3ffefa57d53c9649e39d3a94212423dd04823e542a9eff83e78f6cab328ea10ef822bc63cda3d9fdab46cf679428ff7
7
+ data.tar.gz: d6f94292832fa83ccc5f0a1ddb976a5f2a95cd1db026ea508e8a03465a3ffc66846182a3a4e07009fa75a3e3faa589309824ac8c53279914e07c5a2d77b05b05
@@ -27,14 +27,15 @@ module Uc3DmpProvenance
27
27
  # "client_id": "abcdefghijklmnopqrstuvwxyz"
28
28
  # }
29
29
  # -------------------------------------------------------------------------------------------
30
- def from_lambda_cotext(identity:)
30
+ def from_lambda_cotext(identity:, logger: nil)
31
31
  return nil unless identity.is_a?(Hash) && !identity['iss'].nil? && !identity['client_id'].nil?
32
32
 
33
33
  client = Uc3DmpDynamo::Client.new
34
34
  client_name = _cognito_client_id_to_name(claim: identity)
35
35
 
36
36
  resp = client.get_item(
37
- key: { PK: Helper.append_pk_prefix(client_name), SK: Helper::SK_PROVENANCE_PREFIX }
37
+ key: { PK: Helper.append_pk_prefix(provenance: client_name), SK: Helper::SK_PROVENANCE_PREFIX },
38
+ logger: logger
38
39
  )
39
40
  resp.nil? || resp.empty? ? nil : resp
40
41
  end
@@ -45,9 +46,10 @@ module Uc3DmpProvenance
45
46
  def from_pk(pk:)
46
47
  return nil if pk.nil?
47
48
 
48
- pk = Helper.append_pk_prefix(pk)
49
+ pk = Helper.append_pk_prefix(provenance: pk)
49
50
  resp = client.get_item(
50
- key: { PK: Helper.append_pk_prefix(pk), SK: Helper::SK_PROVENANCE_PREFIX }
51
+ key: { PK: Helper.append_pk_prefix(provenance: pk), SK: Helper::SK_PROVENANCE_PREFIX },
52
+ logger: logger
51
53
  )
52
54
  resp.nil? || resp.empty? ? nil : resp
53
55
  end
@@ -59,6 +61,7 @@ module Uc3DmpProvenance
59
61
  return nil if claim.nil? || !claim.is_a?(Hash) || claim['iss'].nil? || claim['client_id'].nil?
60
62
 
61
63
  user_pool_id = claim['iss'].split('/').last
64
+ logger.debug(message: "Cognito User Pool: #{user_pool_id}, ClientId: #{claim['client_id']}") if logger.respond_to?(:debug)
62
65
  Uc3DmpCognito::Client.get_client_name(client_id: claim['client_id'])
63
66
  end
64
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpProvenance
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-provenance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-07 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json