IAM: Migrate MFA Operations#13801
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 2m 45s ⏱️ - 2h 9m 57s For more details on these failures, see this check. Results for commit 2cff512. ± Comparison against base commit c51a449. ♻️ This comment has been updated with latest results. |
dfangl
left a comment
There was a problem hiding this comment.
Good work! My main issues are the pagination, the typing issues, and storing the user object in the MFA device again.
Maybe we can for now do a dynamic lookup instead of storing the object and relying on object identity for data consistency?
Also, we really should add locks here - but I am happy to tackle this in a follow up when iterating on the IAM provider!
| ) | ||
| store.MFA_DEVICES[serial_number] = device | ||
|
|
||
| user_entity = store.USERS[user_name] |
There was a problem hiding this comment.
We can use the user entity above here! You changed the _get_user_or_raise_error return value here - but this conflicts with other usages. Maybe we should rename that helper as well.
There was a problem hiding this comment.
Worst thing we could also dynamically look the user up based on the users MFA_DEVICES. That would avoid us tracking all this data, but the lookup complexity would be higher.
| # Virtual MFA device - update existing entry | ||
| device = store.MFA_DEVICES[serial_number] | ||
| device.device["EnableDate"] = enable_date | ||
| device.user = user_entity.user |
There was a problem hiding this comment.
What happens by the way if a device is already attached to another user?
There was a problem hiding this comment.
I added a test and a fix to answer this.
Test Results (amd64) - Integration, Bootstrap 5 files ± 0 5 suites ±0 11m 22s ⏱️ - 2h 30m 37s For more details on these failures, see this check. Results for commit 2cff512. ± Comparison against base commit c51a449. |
dfangl
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing my comments!
Motivation
As per the IAM internalization project. This pr implements the operations and resources required for OpenID connector provider management in the IAM service.
Changes
localstack-core/localstack/services/iam/models.py
name, user assignment info, tags
localstack-core/localstack/services/iam/provider.py
Tests
All MFA tests must pass.
TODO
enable_mfa_deviceonce users have been migrated from moto Migrate IAM user implementation #13806Merge after #13800