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

chore(ui): Global auth route protector #521

Open
andrewrisse opened this issue May 15, 2024 · 0 comments
Open

chore(ui): Global auth route protector #521

andrewrisse opened this issue May 15, 2024 · 0 comments
Assignees
Labels
tech-debt 💳 Not a feature, but still necessary

Comments

@andrewrisse
Copy link
Contributor

Currently, every route has to have this code in its +page.server.ts file to ensure the user is redirected to / if their session has expired or doesn't exist.

We need a global route protector that can do this for all desired routes. Investigate if this can just be done with a parent +page.server.ts file and if so, why it's not working.

Test to ensure sessions that have expired are redirected to the login page (for example when a new message is sent in a thread rather than just failing with a 401 or 403.

 const session = await getSession();

  if (!session) {
    throw redirect(303, '/');
  }

Links to any relevant code

(optional) i.e. - https://github.com/defenseunicorns/uds-software-factory/blob/main/README.md?plain=1#L1

Additional context

Add any other context or screenshots about the technical debt here.

@andrewrisse andrewrisse added the tech-debt 💳 Not a feature, but still necessary label May 15, 2024
@andrewrisse andrewrisse added this to the v0.8.0 milestone May 15, 2024
@andrewrisse andrewrisse self-assigned this May 15, 2024
@andrewrisse andrewrisse modified the milestones: v0.8.0, v0.9.0 May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt 💳 Not a feature, but still necessary
Projects
None yet
Development

No branches or pull requests

1 participant