Skip to content

Create some nested dependencies #108

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

Open
chriscarrollsmith opened this issue Mar 15, 2025 · 0 comments
Open

Create some nested dependencies #108

chriscarrollsmith opened this issue Mar 15, 2025 · 0 comments

Comments

@chriscarrollsmith
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant