mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 10:17:48 -05:00
feat(cognito): include all standard attributes in DescribeUserPool Schema (#642)
* feat(cognito): include all standard attributes in DescribeUserPool SchemaAttributes AWS Cognito always returns all 20 standard OIDC attributes (sub, name, email, phone_number, etc.) in SchemaAttributes when describing a user pool, even if none were explicitly configured. Floci was returning only what was passed in Schema during creation. Adds CognitoStandardAttributes with the full default set and a merge() helper that overlays explicit schema overrides and appends custom: attributes after the standard ones. * test(cognito): add compat tests for standard SchemaAttributes across all SDKs Adds DescribeUserPool SchemaAttributes coverage to all compatibility test suites (AWS CLI/bats, Go, Java, Node, Python, Rust), verifying that all 20 standard OIDC attributes are returned and that sub is required and immutable.
This commit is contained in:
12 files changed
+620
-3
No files matched your search
@@ -189,3 +189,33 @@ class TestCognitoAuth:
|
||||
UserPoolId=pool_id, ClientId=client_id
|
||||
)
|
||||
cognito_client.delete_user_pool(UserPoolId=pool_id)
|
||||
|
||||
|
||||
class TestCognitoDescribeUserPoolStandardAttributes:
|
||||
"""DescribeUserPool must return all 20 standard OIDC attributes."""
|
||||
|
||||
STANDARD_ATTRIBUTES = [
|
||||
"sub", "name", "given_name", "family_name", "middle_name", "nickname",
|
||||
"preferred_username", "profile", "picture", "website", "email",
|
||||
"email_verified", "gender", "birthdate", "zoneinfo", "locale",
|
||||
"phone_number", "phone_number_verified", "address", "updated_at",
|
||||
]
|
||||
|
||||
def test_describe_user_pool_returns_all_standard_schema_attributes(self, cognito_client, unique_name):
|
||||
response = cognito_client.create_user_pool(PoolName=f"pytest-schema-{unique_name}")
|
||||
pool_id = response["UserPool"]["Id"]
|
||||
|
||||
try:
|
||||
described = cognito_client.describe_user_pool(UserPoolId=pool_id)
|
||||
schema = described["UserPool"]["SchemaAttributes"]
|
||||
names = [a["Name"] for a in schema]
|
||||
|
||||
assert len(schema) == 20
|
||||
for attr in self.STANDARD_ATTRIBUTES:
|
||||
assert attr in names, f"Missing standard attribute: {attr}"
|
||||
|
||||
sub = next(a for a in schema if a["Name"] == "sub")
|
||||
assert sub["Required"] is True
|
||||
assert sub["Mutable"] is False
|
||||
finally:
|
||||
cognito_client.delete_user_pool(UserPoolId=pool_id)
|
||||
Reference in new issue
Block a user