@mongodb-js/oidc-mock-provider
Advanced tools
Comparing version 0.8.0 to 0.9.0
/// <reference types="node" /> | ||
import type { IncomingMessage, ServerResponse, Server as HTTPServer } from 'http'; | ||
import type { IncomingMessage, ServerResponse, Server as HTTPServer, RequestListener } from 'http'; | ||
export interface TokenMetadata { | ||
@@ -18,2 +18,3 @@ client_id: string; | ||
additionalIssuerMetadata?: () => Record<string, unknown>; | ||
createHTTPServer?: (requestListener: RequestListener) => HTTPServer; | ||
} | ||
@@ -20,0 +21,0 @@ export declare class OIDCMockProvider { |
@@ -21,3 +21,3 @@ "use strict"; | ||
this.state = new Map(); | ||
this.httpServer = (0, http_1.createServer)((req, res) => void this.handleRequest(req, res)); | ||
this.httpServer = (config.createHTTPServer ?? http_1.createServer)((req, res) => void this.handleRequest(req, res)); | ||
this.config = config; | ||
@@ -32,3 +32,3 @@ this.issuer = ''; | ||
const { port } = this.httpServer.address(); | ||
this.issuer = `http://${this.config.hostname ?? 'localhost'}:${port}`; | ||
this.issuer = `${'setSecureContext' in this.httpServer ? 'https' : 'http'}://${this.config.hostname ?? 'localhost'}:${port}`; | ||
this.kid = await randomString(8, 'hex'); | ||
@@ -35,0 +35,0 @@ this.keys = await (0, util_1.promisify)(crypto_1.default.generateKeyPair)('rsa', { |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/devtools-shared", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"repository": { | ||
@@ -76,3 +76,3 @@ "type": "git", | ||
}, | ||
"gitHead": "3ccd22fce39245261ae489f5d1164ac1b18559df" | ||
"gitHead": "98254a49f797fefcce1915d83e01089093a65228" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33642
312