Skip to content

Commit 8404add

Browse files
mabaasitaddaleax
andauthored
chore(deps): update oidc, mongosh, driver (#5879)
* update oidc * test * remove preview * generate lock * check * align allowed and disallowed props * emit when auth fails * timer for web * cleaner polyfil * remove unnecessary logging --------- Co-authored-by: Anna Henningsen <[email protected]>
1 parent 81af861 commit 8404add

File tree

24 files changed

+2084
-1939
lines changed

24 files changed

+2084
-1939
lines changed

package-lock.json

Lines changed: 2028 additions & 1893 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/atlas-service/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
"@mongodb-js/compass-telemetry": "^1.0.0",
7979
"@mongodb-js/compass-user-data": "^0.2.0",
8080
"@mongodb-js/compass-utils": "^0.6.4",
81-
"@mongodb-js/devtools-connect": "^2.6.3",
82-
"@mongodb-js/oidc-plugin": "^0.4.0",
81+
"@mongodb-js/devtools-connect": "^3.0.1",
82+
"@mongodb-js/oidc-plugin": "^1.0.0",
8383
"hadron-app-registry": "^9.1.11",
8484
"compass-preferences-model": "^2.23.0",
8585
"electron": "^29.4.2",

packages/atlas-service/src/main.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ describe('CompassAuthServiceMain', function () {
4545
const mockOidcPlugin = {
4646
mongoClientOptions: {
4747
authMechanismProperties: {
48-
REQUEST_TOKEN_CALLBACK: sandbox
49-
.stub()
50-
.resolves({ accessToken: '1234' }),
51-
REFRESH_TOKEN_CALLBACK: sandbox
52-
.stub()
53-
.resolves({ accessToken: '4321' }),
48+
OIDC_HUMAN_CALLBACK: sandbox.stub().resolves({ accessToken: '1234' }),
5449
},
5550
},
5651
logger: CompassAuthService['oidcPluginLogger'],
@@ -132,7 +127,7 @@ describe('CompassAuthServiceMain', function () {
132127
const userInfo = await CompassAuthService.signIn();
133128
expect(
134129
mockOidcPlugin.mongoClientOptions.authMechanismProperties
135-
.REQUEST_TOKEN_CALLBACK
130+
.OIDC_HUMAN_CALLBACK
136131
// two times because we need to explicitly request token first to show a
137132
// proper error message from oidc plugin in case of failed sign in
138133
).to.have.been.calledTwice;
@@ -152,7 +147,7 @@ describe('CompassAuthServiceMain', function () {
152147

153148
expect(
154149
mockOidcPlugin.mongoClientOptions.authMechanismProperties
155-
.REQUEST_TOKEN_CALLBACK
150+
.OIDC_HUMAN_CALLBACK
156151
// two times because we need to explicitly request token first to show a
157152
// proper error message from oidc plugin in case of failed sign in
158153
).to.have.been.calledTwice;
@@ -168,14 +163,13 @@ describe('CompassAuthServiceMain', function () {
168163
CompassAuthService['plugin'] = {
169164
mongoClientOptions: {
170165
authMechanismProperties: {
171-
REQUEST_TOKEN_CALLBACK: sandbox
166+
OIDC_HUMAN_CALLBACK: sandbox
172167
.stub()
173168
.rejects(
174169
new Error(
175170
'Failed to request token for some specific plugin reason'
176171
)
177172
),
178-
REFRESH_TOKEN_CALLBACK: sandbox.stub().rejects(),
179173
},
180174
},
181175
} as any;

packages/atlas-service/src/main.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ export class CompassAuthService {
207207
throwIfNetworkTrafficDisabled(this.preferences);
208208
}
209209

210-
private static async requestOAuthToken({
211-
signal,
212-
}: { signal?: AbortSignal } = {}) {
210+
private static requestOAuthToken({ signal }: { signal?: AbortSignal } = {}) {
213211
throwIfAborted(signal);
214212
this.throwIfNetworkTrafficDisabled();
215213

@@ -219,14 +217,14 @@ export class CompassAuthService {
219217
);
220218
}
221219

222-
return this.plugin.mongoClientOptions.authMechanismProperties.REQUEST_TOKEN_CALLBACK(
223-
{
224-
clientId: this.config.atlasLogin.clientId,
225-
issuer: this.config.atlasLogin.issuer,
226-
},
220+
return this.plugin.mongoClientOptions.authMechanismProperties.OIDC_HUMAN_CALLBACK(
227221
{
222+
idpInfo: {
223+
clientId: this.config.atlasLogin.clientId,
224+
issuer: this.config.atlasLogin.issuer,
225+
},
228226
// Required driver specific stuff
229-
version: 0,
227+
version: 1,
230228
// While called timeoutContext, this is actually an abort signal that
231229
// plugin will listen to, not a timeout
232230
timeoutContext: signal,

packages/compass-aggregations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"hadron-document": "^8.5.3",
8585
"hadron-type-checker": "^7.2.2",
8686
"lodash": "^4.17.21",
87-
"mongodb": "^6.6.2",
87+
"mongodb": "^6.7.0",
8888
"mongodb-collection-model": "^5.21.0",
8989
"mongodb-data-service": "^22.21.0",
9090
"mongodb-database-model": "^2.21.0",

packages/compass-connections/src/connections-manager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { mongoLogId } from '@mongodb-js/compass-logging/provider';
1313
import { cloneDeep, merge } from 'lodash';
1414
import { adjustConnectionOptionsBeforeConnect } from '@mongodb-js/connection-form';
1515
import mongodbBuildInfo from 'mongodb-build-info';
16+
import { openToast } from '@mongodb-js/compass-components';
1617

1718
type ConnectFn = typeof connect;
1819
type ConnectionInfoId = ConnectionInfo['id'];
@@ -243,6 +244,14 @@ export class ConnectionsManager extends EventEmitter {
243244
);
244245
});
245246

247+
dataService.on?.('oidcAuthFailed', (error) => {
248+
openToast('oidc-auth-failed', {
249+
title: 'Failed to authenticate',
250+
description: error,
251+
variant: 'important',
252+
});
253+
});
254+
246255
if (this.reAuthenticationHandler) {
247256
dataService.addReauthenticationHandler(this.reAuthenticationHandler);
248257
}

packages/compass-e2e-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"hadron-build": "^25.5.2",
5555
"lodash": "^4.17.21",
5656
"mocha": "^10.2.0",
57-
"mongodb": "^6.6.2",
57+
"mongodb": "^6.7.0",
5858
"mongodb-connection-string-url": "^3.0.1",
5959
"mongodb-log-writer": "^1.4.2",
6060
"mongodb-runner": "^5.6.2",

packages/compass-e2e-tests/tests/oidc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ describe('OIDC integration', function () {
321321
afterReauth = true;
322322
await browser.clickVisible(`${modal} ${cancelButton}`);
323323
const errorBanner = await browser.$(
324-
'[data-testid="toast-instance-refresh-failed"]'
324+
'[data-testid="toast-oidc-auth-failed"]'
325325
);
326326
await errorBanner.waitForDisplayed();
327327
expect(await errorBanner.getText()).to.include(

packages/compass-explain-plan/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"d3-hierarchy": "^3.1.2",
8383
"hadron-app-registry": "^9.1.11",
8484
"lodash": "^4.17.21",
85-
"mongodb": "^6.6.2",
85+
"mongodb": "^6.7.0",
8686
"react": "^17.0.2",
8787
"react-redux": "^8.1.3",
8888
"redux": "^4.2.1",

packages/compass-generative-ai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"bson": "^6.7.0",
6161
"compass-preferences-model": "^2.23.0",
6262
"hadron-app-registry": "^9.1.11",
63-
"mongodb": "^6.6.2",
63+
"mongodb": "^6.7.0",
6464
"mongodb-schema": "^12.2.0",
6565
"react": "^17.0.2"
6666
},

0 commit comments

Comments
 (0)