fix: rename uri to url

Signed-off-by: Ryan Hanchett <ryan.hanchett@invitae.com>
This commit is contained in:
Ryan Hanchett
2024-05-08 09:12:28 -07:00
parent 9b0db3f495
commit 96e30c54ab
2 changed files with 8 additions and 8 deletions
@@ -28,26 +28,26 @@ export class JWKSHandler implements TokenHandler {
algorithms: string[];
audiences: string[] | string;
issuers: string[];
uri: string;
url: string;
}> = [];
add(options: Config) {
const algorithms = options.getOptionalStringArray('algorithms') ?? [];
const issuers = options.getOptionalStringArray('issuers') ?? [];
const audiences = options.getOptionalStringArray('audiences') ?? '';
const uri = options.getString('uri');
const url = options.getString('url');
if (!uri.match(/^\S+$/)) {
if (!url.match(/^\S+$/)) {
throw new Error('Illegal URI, must be a set of non-space characters');
}
this.#entries.push({ algorithms, audiences, issuers, uri });
this.#entries.push({ algorithms, audiences, issuers, url });
}
async verifyToken(token: string) {
for (const entry of this.#entries) {
try {
const jwks = createRemoteJWKSet(new URL(entry.uri));
const jwks = createRemoteJWKSet(new URL(entry.url));
const {
payload: { sub },
} = await jwtVerify(token, jwks, {