-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: proper createRemoteJWKSet timeoutDuration handling
fixes #277
- Loading branch information
Showing
7 changed files
with
101 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,7 +1,11 @@ | ||
import { assertThrowsAsync } from 'https://deno.land/[email protected]/testing/asserts.ts'; | ||
|
||
import createRemoteJWKSet from '../dist/deno/jwks/remote.ts'; | ||
import { JWKSNoMatchingKey, JWKSMultipleMatchingKeys } from '../dist/deno/util/errors.ts'; | ||
import { | ||
JWKSTimeout, | ||
JWKSNoMatchingKey, | ||
JWKSMultipleMatchingKeys, | ||
} from '../dist/deno/util/errors.ts'; | ||
|
||
const jwksUri = 'https://www.googleapis.com/oauth2/v3/certs'; | ||
|
||
|
@@ -21,3 +25,8 @@ Deno.test('fetches the JWKSet', async () => { | |
); | ||
await jwks({ alg, kid }, <any>null); | ||
}); | ||
|
||
Deno.test('timeout', async () => { | ||
const jwks = createRemoteJWKSet(new URL(jwksUri), { timeoutDuration: 0 }); | ||
await assertThrowsAsync(() => jwks(<any>{}, <any>null), JWKSTimeout, 'request timed out'); | ||
}); |
This file contains 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