-
Notifications
You must be signed in to change notification settings - Fork 165
refactor(BA-3590): Implement dto for req/res data validation for gradual migra… #7865
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
base: main
Are you sure you want to change the base?
Conversation
1f87e7d to
6f2f113
Compare
|
|
||
| @auth_repository_resilience.apply() | ||
| async def get_credential_by_access_key(self, access_key: str) -> Optional[CredentialData]: | ||
| """ | ||
| Get user credential data by access key. | ||
| Used by authentication middleware to populate request context. | ||
| Args: | ||
| access_key: The access key to look up. | ||
| Returns: | ||
| CredentialData containing user, keypair, and resource policies, | ||
| or None if not found or inactive. | ||
| """ | ||
| return await self._db_source.fetch_credential_by_access_key(access_key) |
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.
How is this function used? I cannot find
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.
In order to use this function
I should change some structures in api/auth.py, but since test for auth.py is not being passed i postponed to modify auth.py for now.
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.
Or I can modify a little bit to use that function as it is only draft pr.
If you think it seems alright.
| __all__ = ( | ||
| # Types | ||
| "AuthTokenType", | ||
| "AuthResponseType", | ||
| "TwoFactorType", | ||
| "AuthResponse", | ||
| "AuthSuccessResponse", | ||
| "RequireTwoFactorRegistrationResponse", | ||
| "RequireTwoFactorAuthResponse", | ||
| "parse_auth_response", | ||
| # Request DTOs | ||
| "AuthorizeRequest", | ||
| "GetRoleRequest", | ||
| "SignupRequest", | ||
| "SignoutRequest", | ||
| "UpdateFullNameRequest", | ||
| "UpdatePasswordRequest", | ||
| "UpdatePasswordNoAuthRequest", | ||
| "UploadSSHKeypairRequest", | ||
| # Response DTOs | ||
| "AuthorizeResponse", | ||
| "GetRoleResponse", | ||
| "SignupResponse", | ||
| "SignoutResponse", | ||
| "UpdateFullNameResponse", | ||
| "UpdatePasswordResponse", | ||
| "UpdatePasswordNoAuthResponse", | ||
| "GetSSHKeypairResponse", | ||
| "SSHKeypairResponse", | ||
| ) |
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.
Let's not export all modules in __init__.py.
Ref: #7702
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.
I will modify to export only needed modules.
Thank you!
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.
removed re-exporting from __init__py.
Please refer my second commit. ( as 'authadapter` imports each modules from init.py, i had to modify from second commit to ensure no conflicts to happen for each commit.)
30118d3 to
44d48e5
Compare
44d48e5 to
c159a1b
Compare
fabafe2 to
dc34f55
Compare
resolves #7625 (BA-3590)
This PR should be merged after #7653 being merged and tested. please don't merge this for now.
should be rebased and tested before merging take place.
This PR would consists of sequence of commits following.
Real Migration will be taken from next pr.
Once this process
tests/unit/manager/api/test_resource)succesfully done, It can be easily tested and automatized.
Checklist: (if applicable)
ai.backend.testdocsdirectory