-
Notifications
You must be signed in to change notification settings - Fork 38
Implementation of Configurable Token Locations in OAuth2 JWT Bearer A… #179
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
base: main
Are you sure you want to change the base?
Conversation
@@ -17,7 +17,12 @@ | |||
UnauthorizedError, | |||
InvalidRequestError, | |||
InvalidTokenError, | |||
InsufficientScopeError, | |||
Insufficie it('should succeed when token is in query', async () => { |
Check notice
Code scanning / CodeQL
Syntax error Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 15 days ago
To fix the syntax error:
- Correct the incomplete identifier
Insufficie
on line 19 by completing it asInsufficientScopeError
. - Ensure the code is syntactically valid and properly formatted.
- Verify that the corrected code aligns with the intended functionality and does not introduce new issues.
The fix involves editing the import statement on line 19 to restore the missing portion of the identifier.
-
Copy modified lines R20-R21 -
Copy modified line R25
@@ -19,3 +19,4 @@ | ||
InvalidTokenError, | ||
Insufficie it('should succeed when token is in query', async () => { | ||
InsufficientScopeError, | ||
it('should succeed when token is in query', async () => { | ||
const jwt = await createJwt(); | ||
@@ -23,3 +24,3 @@ | ||
tokenLocation: TokenLocation.QUERY, | ||
});peError, | ||
}); | ||
TokenLocation, |
@@ -17,7 +17,12 @@ | |||
UnauthorizedError, | |||
InvalidRequestError, | |||
InvalidTokenError, | |||
InsufficientScopeError, | |||
Insufficie it('should succeed when token is in query', async () => { |
Check notice
Code scanning / CodeQL
Syntax error Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 15 days ago
To fix the syntax error, the misplaced code needs to be corrected. Specifically:
- The
Insufficie
fragment on line 20 should be completed asInsufficientScopeError
and properly aligned with the import statement on line 19. - The
it('should succeed when token is in query', async () => {
test case should be moved to its proper location after the imports.
This fix ensures that the code is syntactically correct and can be executed as intended.
-
Copy modified line R20 -
Copy modified lines R24-R30
@@ -19,7 +19,3 @@ | ||
InvalidTokenError, | ||
Insufficie it('should succeed when token is in query', async () => { | ||
const jwt = await createJwt(); | ||
const baseUrl = await setup({ | ||
tokenLocation: TokenLocation.QUERY, | ||
});peError, | ||
InsufficientScopeError, | ||
TokenLocation, | ||
@@ -27,2 +23,9 @@ | ||
|
||
it('should succeed when token is in query', async () => { | ||
const jwt = await createJwt(); | ||
const baseUrl = await setup({ | ||
tokenLocation: TokenLocation.QUERY, | ||
}); | ||
}); | ||
|
||
const expectFailsWith = async ( |
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
This PR addresses issue #147 by adding the ability to configure which locations are checked for JWT tokens (header, query, or body parameters). Previously, the middleware would automatically check all possible token locations. Now, users can restrict token extraction to specific locations for enhanced security.
Changes
TokenLocation
enumReferences
Testing
Checklist