Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Add get_current_user function to oauth_util.py #27

Open
sanders41 opened this issue Jun 14, 2022 · 0 comments
Open

Add get_current_user function to oauth_util.py #27

sanders41 opened this issue Jun 14, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@sanders41
Copy link

Is your feature request related to a specific problem?

oauth_util.py should have a get_current_user function

A description of what the problem is.
Ex. I'm always frustrated when [...]

Describe the solution you'd like

from fastapi import Depends, Security
from fastapi.security import SecurityScopes
from sqlalchemy.orm import Session

from fideslib.oauth.api.deps import get_db
from fideslib.models.fides_user import FidesUser

async def get_current_user(
    security_scopes: SecurityScopes,
    authorization: str = Security(oauth2_scheme),
    db: Session = Depends(get_db),
) -> FidesUser:
    """A wrapper around verify_oauth_client that returns that client's user if one exsits."""
    client = await verify_oauth_client(
        security_scopes=security_scopes,
        authorization=authorization,
        db=db,
    )
    return client.user

Describe alternatives you've considered, if any

Let each library implement their own version.

Additional context

Add any other context or screenshots about the feature request here.

@sanders41 sanders41 added the enhancement New feature or request label Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant