-
Notifications
You must be signed in to change notification settings - Fork 0
fix: switch auth tokens to httpOnly cookies #117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
616c33c
feat: switch auth tokens to httpOnly cookies
GitAddRemote 5bca8c1
fix: address PR review comments on httpOnly cookie implementation
GitAddRemote 67076ef
fix: cast set-cookie header through unknown to satisfy strict TS
GitAddRemote 87ae8cd
fix: address review comments on cookie auth controller and e2e test
GitAddRemote cf830f7
fix: address review comments on port type and e2e test assertions
GitAddRemote 472247b
fix: address PR117 review comments
GitAddRemote 6f8970d
fix: correct LocalStrategy return type and tighten e2e cookie assertions
GitAddRemote 1f63a40
feat: add GET /auth/me endpoint for session state population
GitAddRemote 25902d0
fix: resolve merge conflicts with main
GitAddRemote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,20 @@ | ||
| import { Injectable } from '@nestjs/common'; | ||
| import { AuthGuard } from '@nestjs/passport'; | ||
| import { | ||
| Injectable, | ||
| CanActivate, | ||
| ExecutionContext, | ||
| UnauthorizedException, | ||
| } from '@nestjs/common'; | ||
| import { Request } from 'express'; | ||
|
|
||
| @Injectable() | ||
| export class RefreshTokenAuthGuard extends AuthGuard('refresh-token') {} | ||
| export class RefreshTokenAuthGuard implements CanActivate { | ||
| canActivate(context: ExecutionContext): boolean { | ||
| const request = context.switchToHttp().getRequest<Request>(); | ||
| const refreshToken = request.cookies?.refresh_token; | ||
| if (!refreshToken) { | ||
| throw new UnauthorizedException('No refresh token provided'); | ||
| } | ||
| request.user = { refreshToken }; | ||
| return true; | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.