Skip to content

Commit

Permalink
remove abort-controller and address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit committed Jun 4, 2024
1 parent 343011f commit 67ede2b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"xvfb-maybe": "^0.2.1"
},
"dependencies": {
"abort-controller": "^3.0.0",
"express": "^4.18.2",
"open": "^9.1.0",
"openid-client": "^5.6.4"
Expand Down
3 changes: 1 addition & 2 deletions src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
oktaBrowserAuthCodeFlow,
oktaBrowserDeviceAuthFlow,
} from '../test/oidc-test-provider';
import { AbortController, AbortSignal } from './util';
import { MongoLogWriter } from 'mongodb-log-writer';
import { PassThrough } from 'stream';
import { verifySuccessfulAuthCodeFlowLog } from '../test/log-hook-verification-helpers';
Expand Down Expand Up @@ -59,7 +58,7 @@ function requestToken(
abortSignal?: OIDCAbortSignal
): ReturnType<OIDCCallbackFunction> {
return plugin.mongoClientOptions.authMechanismProperties.OIDC_HUMAN_CALLBACK({
timeoutContext: abortSignal ?? new AbortController().signal,
timeoutContext: abortSignal,
version: 1,
idpInfo: oidcParams,
});
Expand Down
1 change: 0 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
} from './types';
import { MongoDBOIDCError } from './types';
import {
AbortController,
errorString,
messageFromError,
normalizeObject,
Expand Down
1 change: 0 additions & 1 deletion src/rfc-8252-http-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { AddressInfo } from 'net';
import { createConnection } from 'net';
import type { SinonSandbox } from 'sinon';
import sinon from 'sinon';
import { AbortController } from './util';
import { promisify } from 'util';
import { randomBytes } from 'crypto';

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export interface IdPServerResponse {
*/
export interface OIDCCallbackParams {
refreshToken?: string;
timeoutContext: OIDCAbortSignal;
timeoutContext?: OIDCAbortSignal;
version: 1;
username?: string;
idpInfo?: IdPServerInfo;
Expand Down
7 changes: 0 additions & 7 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ export function errorString(err: unknown): string {
);
}

export const AbortController =
// eslint-disable-next-line @typescript-eslint/no-var-requires
globalThis.AbortController ?? require('abort-controller').AbortController;
export const AbortSignal =
// eslint-disable-next-line @typescript-eslint/no-var-requires
globalThis.AbortSignal ?? require('abort-controller').AbortSignal;

// AbortSignal.timeout, but consistently .unref()ed
export function timeoutSignal(ms: number): AbortSignal {
const controller = new AbortController();
Expand Down

0 comments on commit 67ede2b

Please sign in to comment.