From 09554a6381472581b8b7070a21ce4ef2d2e5aded Mon Sep 17 00:00:00 2001 From: Matt Dale <9760375+matthewdale@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:55:44 -0800 Subject: [PATCH] Update callback naming. Fix auth connection string tests. --- source/auth/auth.rst | 10 ++++---- .../auth/tests/legacy/connection-string.json | 23 +++---------------- .../auth/tests/legacy/connection-string.yml | 16 ++----------- 3 files changed, 10 insertions(+), 39 deletions(-) diff --git a/source/auth/auth.rst b/source/auth/auth.rst index fda43446af..f834b6a103 100644 --- a/source/auth/auth.rst +++ b/source/auth/auth.rst @@ -1257,18 +1257,18 @@ mechanism_properties Callback`_ are provided for the same ``MongoClient``, the driver MUST raise an error. - CALLBACK + OIDC_CALLBACK An `OIDC Callback`_ that returns OIDC credentials. Drivers MAY allow the user to specify an `OIDC Callback`_ using a ``MongoClient`` configuration instead of a mechanism property, depending on what is idiomatic for the - driver. Drivers MUST NOT support both the ``CALLBACK`` mechanism property - and the ``MongoClient`` configuration. + driver. Drivers MUST NOT support both the ``OIDC_CALLBACK`` mechanism + property and the ``MongoClient`` configuration. - HUMAN_CALLBACK + OIDC_HUMAN_CALLBACK A `Human Callback`_ that returns OIDC credentials. Drivers MAY allow the user to specify a `Human Callback`_ using a ``MongoClient`` configuration instead of a mechanism property, depending on what is idiomatic for the - driver. Drivers MUST NOT support both the ``HUMAN_CALLBACK`` mechanism + driver. Drivers MUST NOT support both the ``OIDC_HUMAN_CALLBACK`` mechanism property and the ``MongoClient`` configuration. Drivers MUST return an error if both an `OIDC Callback`_ and `Human Callback` are provided for the same ``MongoClient``. This property is only required for drivers that support the diff --git a/source/auth/tests/legacy/connection-string.json b/source/auth/tests/legacy/connection-string.json index c7bb483689..982edb8b36 100644 --- a/source/auth/tests/legacy/connection-string.json +++ b/source/auth/tests/legacy/connection-string.json @@ -510,21 +510,10 @@ } }, { - "description": "should ignore username and password if specified for aws provider (MONGODB-OIDC)", + "description": "should throw an exception if supplied a password (MONGODB-OIDC)", "uri": "mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:aws", - "callback": [ - "oidcRequest" - ], - "valid": true, - "credential": { - "username": null, - "password": null, - "source": "$external", - "mechanism": "MONGODB-OIDC", - "mechanism_properties": { - "PROVIDER_NAME": "aws" - } - } + "valid": false, + "credential": null }, { "description": "should throw an exception if username is specified for aws (MONGODB-OIDC)", @@ -538,12 +527,6 @@ "valid": false, "credential": null }, - { - "description": "should throw an exception custom callback is chosen but no callback is provided (MONGODB-OIDC)", - "uri": "mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:custom", - "valid": false, - "credential": null - }, { "description": "should throw an exception if neither provider nor callbacks specified (MONGODB-OIDC)", "uri": "mongodb://localhost/?authMechanism=MONGODB-OIDC", diff --git a/source/auth/tests/legacy/connection-string.yml b/source/auth/tests/legacy/connection-string.yml index 0d0a352b87..d2658e0309 100644 --- a/source/auth/tests/legacy/connection-string.yml +++ b/source/auth/tests/legacy/connection-string.yml @@ -370,18 +370,10 @@ tests: mechanism: MONGODB-OIDC mechanism_properties: PROVIDER_NAME: aws -- description: should ignore username and password if specified for aws provider (MONGODB-OIDC) +- description: should throw an exception if supplied a password (MONGODB-OIDC) uri: mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:aws - callback: - - oidcRequest - valid: true + valid: false credential: - username: - password: - source: "$external" - mechanism: MONGODB-OIDC - mechanism_properties: - PROVIDER_NAME: aws - description: should throw an exception if username is specified for aws (MONGODB-OIDC) uri: mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&PROVIDER_NAME:aws valid: false @@ -390,10 +382,6 @@ tests: uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:invalid valid: false credential: -- description: should throw an exception custom callback is chosen but no callback is provided (MONGODB-OIDC) - uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:custom - valid: false - credential: - description: should throw an exception if neither provider nor callbacks specified (MONGODB-OIDC) uri: mongodb://localhost/?authMechanism=MONGODB-OIDC valid: false