Skip to content

Commit

Permalink
fix(NODE-2939): dedup canonicalization props
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Feb 10, 2022
1 parent d8143ea commit 48025aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
14 changes: 12 additions & 2 deletions src/cmap/auth/gssapi.ts
Expand Up @@ -12,12 +12,22 @@ import {
import { Callback, ns } from '../../utils';
import { AuthContext, AuthProvider } from './auth_provider';

type CanonicalizationOptions = boolean | 'none' | 'forward' | 'forwardAndReverse';
/** @public */
export const CANONICALIZATION_VALUES = [
true,
false,
'none',
'forward',
'forwardAndReverse'
] as const;

/** @public */
export type CanonicalizationProperties = typeof CANONICALIZATION_VALUES[number];

type MechanismProperties = {
/** @deprecated use `CANONICALIZE_HOST_NAME` instead */
gssapiCanonicalizeHostName?: boolean;
CANONICALIZE_HOST_NAME?: CanonicalizationOptions;
CANONICALIZE_HOST_NAME?: CanonicalizationProperties;
SERVICE_HOST?: string;
SERVICE_NAME?: string;
SERVICE_REALM?: string;
Expand Down
6 changes: 1 addition & 5 deletions src/cmap/auth/mongo_credentials.ts
Expand Up @@ -2,6 +2,7 @@
import type { Document } from '../../bson';
import { MongoAPIError, MongoMissingCredentialsError } from '../../error';
import { emitWarningOnce } from '../../utils';
import { CANONICALIZATION_VALUES, CanonicalizationProperties } from './gssapi';
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './providers';

// https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst
Expand All @@ -25,11 +26,6 @@ function getDefaultAuthMechanism(hello?: Document): AuthMechanism {
return AuthMechanism.MONGODB_CR;
}

const CANONICALIZATION_VALUES = [true, false, 'none', 'forward', 'forwardAndReverse'];

/** @public */
export type CanonicalizationProperties = boolean | 'none' | 'forward' | 'forwardAndReverse';

/** @public */
export interface AuthMechanismProperties extends Document {
SERVICE_HOST?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -176,9 +176,9 @@ export type {
ResumeToken,
UpdateDescription
} from './change_stream';
export type { CANONICALIZATION_VALUES, CanonicalizationProperties } from './cmap/auth/gssapi';
export type {
AuthMechanismProperties,
CanonicalizationProperties,
MongoCredentials,
MongoCredentialsOptions
} from './cmap/auth/mongo_credentials';
Expand Down
3 changes: 2 additions & 1 deletion test/manual/kerberos.test.js
Expand Up @@ -82,7 +82,8 @@ describe('Kerberos', function () {
context('when passing in CANONICALIZE_HOST_NAME', function () {
beforeEach(function () {
if (process.platform === 'darwin') {
this.currentTest.skipReason = 'DNS does not resolve with proper CNAME record on evergreen MacOS';
this.currentTest.skipReason =
'DNS does not resolve with proper CNAME record on evergreen MacOS';
this.skip();
}
});
Expand Down

0 comments on commit 48025aa

Please sign in to comment.