Skip to content
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

Guard routes with a RouteGuard component and/or middleware #20

Open
NathanWEdwards opened this issue Sep 1, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@NathanWEdwards
Copy link
Collaborator

To minimize the amount of replicated code on pages and API routes for validating user authentication, a component that guards pages and routes, or a middleware, should be utilized.

JavaScript modules that employ a middleware design pattern NextAuth.js (soon to become Auth.js) and Passport.js offer convenient features to manage the request and response cycle of NodeJS applications in a few lines of code.

@NathanWEdwards
Copy link
Collaborator Author

Pull request 5 introduces a context for representing authentication states within the application. A feature branch protected-api-call has been created, and is introduced in Pull request 34. A higher-order client component, ProtectedComponent, wraps around components that require authentication.

Further effort is needed to encapsulate content within the ProtectedComponent and guard against unintential execution of code within a ProtectedComponent when pages are accessed without authorization.

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

No branches or pull requests

4 participants