(issuerBaseURL: string)
| 117 | } |
| 118 | |
| 119 | const fetchDiscoveryDocumentPromise = async (issuerBaseURL: string) => { |
| 120 | const response = await fetch(buildDiscoveryUrl(issuerBaseURL)) |
| 121 | if (!response.ok) { |
| 122 | throw new Error(`Failed to fetch authorization server metadata: ${response.status}`) |
| 123 | } |
| 124 | const json = await response.json() |
| 125 | if (!isRecord(json) || typeof json["issuer"] !== "string" || typeof json["jwks_uri"] !== "string") { |
| 126 | throw new Error("Invalid authorization server metadata") |
| 127 | } |
| 128 | return { issuer: json["issuer"], jwksUri: json["jwks_uri"] } |
| 129 | } |
| 130 | |
| 131 | const getAuthorizationToken = (headers: HttpHeaders.Headers, authRequired: boolean) => { |
| 132 | const authorization = HttpHeaders.get(headers, "authorization") |
no test coverage detected
searching dependent graphs…