Closed tivaliy closed 2 years ago
Let's close this "issue". Currently, I followed up with the following implementation (using dependecy):
async def get_current_user(
settings: AppSettings = Depends(get_app_settings),
http_auth: Optional[HTTPAuthorizationCredentials] = Depends(HTTPBearer(auto_error=False)),
) -> CognitoCurrentUser:
current_user_auth = CognitoCurrentUser(
region=settings.aws_region,
userPoolId=settings.userpool_id,
client_id=settings.app_client_id,
)
# Set custom Cognito claims class with extra attributes
current_user_auth.user_info = settings.user_info_class
return await current_user_auth(http_auth)
Hi, thank you for you great work. I have a question/feature request.
Currently, there is no straightforward way to pass
user_info
into a respectiveUserInfoAuth
derived class (eg.CognitoCurrentUser
) before the instantinaion and only inheritance will work. So it'll be great to have something like this:The current implementation of
CognitoCurrentUser
doesn't allow to do this.It will be nice to have something like this:
or be more explicit and add
user_info
as a paramter toCognitoCurrentUser
__init__
method