You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After reviewing auth logic in #202, I propose refactoring the auth validation mechanism to improve structure, maintainability, and security. The current approach requires calling a.requireAuth(w, r, authPolicies) manually in every (protected) handler, which can lead to security risks if a developer forgets to include it.
Current Issue
The current approach requires explicit authentication checks in each protected handler:
Summary
After reviewing auth logic in #202, I propose refactoring the auth validation mechanism to improve structure, maintainability, and security. The current approach requires calling
a.requireAuth(w, r, authPolicies)
manually in every (protected) handler, which can lead to security risks if a developer forgets to include it.Current Issue
The current approach requires explicit authentication checks in each protected handler:
This approach has several drawbacks:
Proposed Solution
Introduce a middleware-based approach that enforces authentication centrally. The middleware will:
/healthcheck
).Policy Definition
Middleware Implementation
Middleware Usage
Note: This code is for demo purposes and will be improved.
Benefits of This Approach
Next Steps
If this proposal is acceptable, I will raise a PR to implement this refactor. Let me know your thoughts!
The text was updated successfully, but these errors were encountered: