cloud-foundry 0.5.4__tar.gz → 0.5.5__tar.gz
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.
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/PKG-INFO +1 -1
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/__init__.py +1 -1
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/services/authorization_api/security_lambda.py +22 -4
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/.gitignore +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/LICENSE +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/README.md +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/archive_builder.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/mail_publisher.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/migrations/__init__.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/migrations/forget_site_objects.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/__init__.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/api_waf.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/cdn.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/cdn_api_origin.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/cdn_site_origin.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/connection_store.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/custom_domain.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/document_repository.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/domain.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/function.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/idle_reaper.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/postgres_schema.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/publisher.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/python_function.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/queue.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/rest_api.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/schedule.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/site_bucket.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/topic.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/topic_subscription.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/ui_publisher.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/websocket_api.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/pulumi/websocket_function.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/python_archive_builder.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/services/mail_publisher.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/services/postgres_schema_bootstrap.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/aws_openapi_editor.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/hash_comparator.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/idle_reaper_client.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/logger.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/names.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/openapi_editor.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/utils/websocket_utils.py +0 -0
- {cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloud-foundry
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: cloud-foundry is a curated set of cloud components that can be used to assemble cloud-based applications.
|
|
5
5
|
Project-URL: Documentation, https://github.com/DanRepik/cloud-foundry
|
|
6
6
|
Project-URL: Source, https://github.com/DanRepik/cloud-foundry
|
|
@@ -59,15 +59,22 @@ class AuthorizationServices:
|
|
|
59
59
|
self.user_pool_id = user_pool_id or os.getenv("USER_POOL_ID")
|
|
60
60
|
self.client_id = client_id or os.getenv("CLIENT_ID")
|
|
61
61
|
self.client_secret = client_secret or os.getenv("CLIENT_SECRET")
|
|
62
|
+
# Preferred over CLIENT_SECRET: a Lambda's environment is readable by
|
|
63
|
+
# anyone with lambda:GetFunctionConfiguration. Read on first use.
|
|
64
|
+
self.client_secret_arn = os.getenv("CLIENT_SECRET_ARN")
|
|
62
65
|
self.user_admin_group = user_admin_group or os.getenv("USER_ADMIN_GROUP")
|
|
63
66
|
self.user_default_group = user_default_group or os.getenv("USER_DEFAULT_GROUP")
|
|
64
67
|
region = os.getenv("AWS_REGION")
|
|
65
68
|
self.cognito_client = boto3.client("cognito-idp", region_name=region)
|
|
66
69
|
|
|
67
70
|
def handler(self, event, context):
|
|
71
|
+
if not self.client_secret and self.client_secret_arn:
|
|
72
|
+
self.client_secret = boto3.client("secretsmanager").get_secret_value(
|
|
73
|
+
SecretId=self.client_secret_arn
|
|
74
|
+
)["SecretString"]
|
|
68
75
|
assert (
|
|
69
76
|
self.user_pool_id and self.client_id and self.client_secret
|
|
70
|
-
), "USER_POOL_ID, CLIENT_ID, and CLIENT_SECRET must be set"
|
|
77
|
+
), "USER_POOL_ID, CLIENT_ID, and CLIENT_SECRET (or CLIENT_SECRET_ARN) must be set"
|
|
71
78
|
|
|
72
79
|
path = event.get("resource", "")
|
|
73
80
|
http_method = event.get("httpMethod", "").upper()
|
|
@@ -278,9 +285,18 @@ class AuthorizationServices:
|
|
|
278
285
|
params = {"USERNAME": username, "PASSWORD": body["password"]}
|
|
279
286
|
else:
|
|
280
287
|
return bad_request("password or refresh_token is required")
|
|
281
|
-
params["SECRET_HASH"] = self.calculate_secret_hash(username)
|
|
282
288
|
|
|
283
289
|
try:
|
|
290
|
+
# A refresh's SECRET_HASH must use the user's Cognito username;
|
|
291
|
+
# in a pool that signs in by email that is the sub, not the email.
|
|
292
|
+
hash_name = (
|
|
293
|
+
cognito_client.admin_get_user(
|
|
294
|
+
UserPoolId=self.user_pool_id, Username=username
|
|
295
|
+
)["Username"]
|
|
296
|
+
if flow == "REFRESH_TOKEN_AUTH"
|
|
297
|
+
else username
|
|
298
|
+
)
|
|
299
|
+
params["SECRET_HASH"] = self.calculate_secret_hash(hash_name)
|
|
284
300
|
response = cognito_client.initiate_auth(
|
|
285
301
|
AuthFlow=flow, AuthParameters=params, ClientId=self.client_id
|
|
286
302
|
)
|
|
@@ -409,8 +425,10 @@ class AuthorizationServices:
|
|
|
409
425
|
Authorization header is missing, so callers' `if not access_token`
|
|
410
426
|
checks behave correctly.
|
|
411
427
|
"""
|
|
412
|
-
|
|
413
|
-
|
|
428
|
+
# Header names arrive in whatever case the client (or CloudFront,
|
|
429
|
+
# or HTTP/2's lower case) sent.
|
|
430
|
+
headers = {k.lower(): v for k, v in (event.get("headers") or {}).items()}
|
|
431
|
+
authorization_header = headers.get("authorization")
|
|
414
432
|
|
|
415
433
|
if not authorization_header:
|
|
416
434
|
log.error("Authorization header is missing")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloud_foundry-0.5.4 → cloud_foundry-0.5.5}/cloud_foundry/services/postgres_schema_bootstrap.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|