uc3-dmp-cognito 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-cognito/client.rb +6 -6
- data/lib/uc3-dmp-cognito/version.rb +1 -1
- data/lib/uc3-dmp-cognito.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2425dd3328c77abb612d5a1e2cf738599b70dddaa94355a750b4b28552369a23
|
4
|
+
data.tar.gz: '09b47e93a901fefd7629ee2f1bf9b83006fa697b385b8151e4887d6d0df6d18c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6494c7100d7780c399050cb503223a9c2cd1f40c7fbf97cd16db14450b21e1f85c660060ed3f6020df5d5958fdb427bbc05b264a58feddebb229311ed6511cd2
|
7
|
+
data.tar.gz: e2f26bf56981472da2f8af1747812f500f3a711c27d630a7441eba8fc78f78d08688025467a9bd7579d7c905b187e5e6023866159221f50f22283f12847eb28f
|
@@ -1,25 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Uc3DmpCognito
|
4
|
-
class
|
4
|
+
class ClientError < StandardError; end
|
5
5
|
|
6
6
|
# Helper functions for working with Dynamo JSON
|
7
7
|
class Client
|
8
|
-
MSG_MISSING_POOL = 'No Cognito Pool defined. Expecting `ENV[\'
|
8
|
+
MSG_MISSING_POOL = 'No Cognito Pool defined. Expecting `ENV[\'COGNITO_USER_POOL_ID\']'
|
9
9
|
MSG_COGNITO_ERROR = 'Cognito User Pool Error - %{msg} - %{trace}'
|
10
10
|
|
11
11
|
class << self
|
12
12
|
# Fetch the name of the client from the client id provided.
|
13
13
|
# DMP Provenance names match the Cognito client names
|
14
|
-
def get_client_name(client_id:)
|
15
|
-
user_pool_id = ENV
|
16
|
-
raise
|
14
|
+
def get_client_name(client_id:, debug: false)
|
15
|
+
user_pool_id = ENV.fetch('COGNITO_USER_POOL_ID', nil)
|
16
|
+
raise ClientError, MSG_MISSING_POOL if user_pool_id.nil?
|
17
17
|
|
18
18
|
client = Aws::CognitoIdentityProvider::Client.new(region: ENV.fetch('AWS_REGION', nil))
|
19
19
|
resp = client.describe_user_pool_client({ user_pool_id: user_pool_id, client_id: client_id })
|
20
20
|
resp&.user_pool_client&.client_name&.downcase
|
21
21
|
rescue Aws::Errors::ServiceError => e
|
22
|
-
raise
|
22
|
+
raise ClientError, format(MSG_COGNITO_ERROR, msg: e.message, trace: e.backtrace)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/uc3-dmp-cognito.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-cognito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: logger
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.4'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.4'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: aws-sdk-cognitoidentityprovider
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|