Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 49 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/atlas-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@mongodb-js/compass-utils": "^0.6.9",
"@mongodb-js/devtools-connect": "^3.2.5",
"@mongodb-js/devtools-proxy-support": "^0.3.5",
"@mongodb-js/oidc-plugin": "^1.0.0",
"@mongodb-js/oidc-plugin": "^1.1.1",
"hadron-app-registry": "^9.2.2",
"compass-preferences-model": "^2.26.0",
"electron": "^29.4.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas-service/src/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ describe('CompassAuthServiceMain', function () {
} as any;
await CompassAuthService.init(preferences, {} as any);
CompassAuthService['config'] = defaultConfig;
expect(getListenerCount(logger)).to.eq(27);
expect(getListenerCount(logger)).to.eq(30);
// We did all preparations, reset sinon history for easier assertions
sandbox.resetHistory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@ describe('Authentication OIDC Connection Form', function () {
});
});

it('handles the Use ID token instead of Access Token checkbox', async function () {
fireEvent.click(screen.getByText('Use ID token instead of Access Token'));
await expectToConnectWith({
connectionString:
'mongodb://localhost:27017/?authMechanism=MONGODB-OIDC&authSource=%24external',
oidc: {
passIdTokenAsAccessToken: true,
},
});
});

it('handles the Use ID token instead of Access Token checkbox on and off', async function () {
fireEvent.click(screen.getByText('Use ID token instead of Access Token'));
fireEvent.click(screen.getByText('Use ID token instead of Access Token'));
await expectToConnectWith({
connectionString:
'mongodb://localhost:27017/?authMechanism=MONGODB-OIDC&authSource=%24external',
oidc: {},
});
});

it('handles the Consider Target Endpoint Trusted checkbox', async function () {
fireEvent.click(screen.getByText('Consider Target Endpoint Trusted'));
await expectToConnectWith({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,38 @@ function AuthenticationOIDC({
/>
</FormFieldContainer>

<FormFieldContainer>
<Checkbox
onChange={({
target: { checked },
}: React.ChangeEvent<HTMLInputElement>) => {
if (checked) {
return handleFieldChanged('passIdTokenAsAccessToken', true);
}

return handleFieldChanged(
'passIdTokenAsAccessToken',
undefined
);
}}
data-testid="oidc-pass-id-token-as-access-token"
id="oidc-pass-id-token-as-access-token"
label={
<>
<Label htmlFor="oidc-pass-id-token-as-access-token">
Use ID token instead of Access Token
</Label>
<Description>
Use ID tokens instead of access tokens to work around
misconfigured or broken identity providers. This will only
work if the server is configured correspondingly.
</Description>
</>
}
checked={!!connectionOptions.oidc?.passIdTokenAsAccessToken}
/>
</FormFieldContainer>

{showOIDCDeviceAuthFlow && (
<FormFieldContainer>
<Checkbox
Expand Down
2 changes: 1 addition & 1 deletion packages/data-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@mongodb-js/devtools-docker-test-envs": "^1.3.2",
"@mongodb-js/eslint-config-compass": "^1.1.4",
"@mongodb-js/mocha-config-compass": "^1.3.10",
"@mongodb-js/oidc-plugin": "^1.0.0",
"@mongodb-js/oidc-plugin": "^1.1.1",
"@mongodb-js/prettier-config-compass": "^1.0.2",
"@mongodb-js/tsconfig-compass": "^1.0.4",
"@types/lodash": "^4.14.188",
Expand Down