-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: iauth updates #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Lmk if you want to chat.
- replacing custom authorizer with jwtAuthorizer - update custom resource in cognito-auth to only create resources that cannot be created in CDK - enabling PUT /tenants to be protected with JWT Auth instead of IAM. This means that it is available via sync for saas Admin and async for eventBridge target - added another client for m2m flow. This is used for eventBridge to APIGW authZ - removed ControlPlaneIDPDetails -- too cryptic/vague
Signed-off-by: github-actions <[email protected]>
…for creating new admin users
Signed-off-by: github-actions <[email protected]>
Appreciate the addition of support for pagination here; thank you 😎 |
user_details = {} | ||
user_details['idpDetails'] = idp_details | ||
user_details['userName'] = username | ||
user_details['userName'] = userId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of userId
provides a more unique way of identifying a user - especially with something like Auth0. So, using userId
rather than username
is a better approach. However, I don't think that the username
claim for a user should be set to a userId
value; username
and userId
are separate entities, and both are valid for a user 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I definitely agree that username
and userId
are two separate entities.
The thing to consider here is that the Cognito API uses username
for API operations. For example, if you look at the enable_user(...)
function
sbt-aws/resources/functions/user-management/cognito_user_management_service.py
Lines 133 to 143 in f699f38
def enable_user(self, event): | |
user_details = event | |
user_pool_id = user_details['idpDetails']['idp']['userPoolId'] | |
user_name = user_details['userName'] | |
response = client.admin_enable_user( | |
Username=user_name, | |
UserPoolId=user_pool_id | |
) | |
return response |
Username=user_name, |
Docs for admin_enable_user
API: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cognito-idp/client/admin_enable_user.html
So, in order to conform to the new Users API schema, what I'm doing here is using the userId
(which end-users will pass in for lookups and other API calls) and mapping that internally to the userName
so it can work with the Cognito API.
As I write this, one improvement that I think we need to make is to clarify to end-users what the value they should use for userId
. This might require us to map the userName
we get from a call such as admin_get_user(...)
that we make as part of this function
def get_user(self, event): |
userId
and pass that back to the user. The result would be that the end-user sees userId
wherever they would typically see userName
and so we avoid confusion. That's something we can iron out, though. Appreciate the comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created issue: #63
Issue # (if applicable)
Closes #54 , #53
Reason for this change
The objective of this PR is to simplify the IAuth interface.
Description of changes
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.