Skip to content

Create some nested dependencies #108

Open
@chriscarrollsmith

Description

@chriscarrollsmith

Right now we're using get_optional_user with an additional check-and-redirect in the route body for routes like 'login' or 'register' that should only be seen by unauthenticated users. We could take 'get_optional_user' and wrap it in a check-and-redirect to create a new, nested dependency, 'require_unauthenticated_client' or something like that. Similarly, for a route like 'delete_account' that uses 'get_authenticated_user' but also requires re-entry of credentials with an additional check in the route body to confirm that the credentials match the authenticated_user, we could create a nested dependency 'get_authenticated_user_with_credentials_check' (or maybe something a bit less verbose) that wraps 'get_authenticated_user' with the extra check. Obviously, we would need to identify and update routes that could benefit from these new dependencies (which would be defined in dependencies.py). We would also need to update the test suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions