Skip to content

Add redirection to pageJwtMiddleware#44

Merged
CharlesFarris merged 3 commits into
mainfrom
add-authentication-redirection
May 23, 2026
Merged

Add redirection to pageJwtMiddleware#44
CharlesFarris merged 3 commits into
mainfrom
add-authentication-redirection

Conversation

@CharlesFarris

Copy link
Copy Markdown
Contributor
  • Update home and add-todo pages
  • Update tests

- Update home and add-todo pages
- Update tests
Copilot AI review requested due to automatic review settings May 22, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes the page-level JWT auth behavior so unauthenticated/invalid sessions are redirected to the login page (instead of returning 401), and ensures the Home page is protected by that middleware.

Changes:

  • Update pageJwtMiddleware to redirect to /login on JWT failures.
  • Add pageJwtMiddleware protection to the Home page route.
  • Update/extend tests to assert redirect behavior and valid-JWT rendering.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/shared/pageJwtMiddleware.ts Wrap JWT verification to redirect to the login page on auth failure.
src/shared/pageJwtMiddleware.test.ts Update middleware tests to expect redirects instead of 401s.
src/features/home/homePage.tsx Protect the Home page with pageJwtMiddleware.
src/features/home/homePage.test.tsx Add redirect test and update rendering test to include valid JWT cookie.
src/features/add-todo/addToDoPage.test.tsx Update add-todo page test to expect redirect instead of 401 when missing JWT.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/shared/pageJwtMiddleware.ts
Comment thread src/shared/pageJwtMiddleware.test.ts
Comment thread src/shared/pageJwtMiddleware.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@CharlesFarris CharlesFarris self-assigned this May 23, 2026
@CharlesFarris CharlesFarris merged commit caa904c into main May 23, 2026
4 checks passed
@CharlesFarris CharlesFarris deleted the add-authentication-redirection branch May 23, 2026 00:25
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

Successfully merging this pull request may close these issues.

2 participants