Configuring only x509 authentication

Entries from my config file:
port: 27017
mode: requireTLS
certificateKeyFile: D:\certnew\MongoDb\Test3\test-server.pem
CAFile: D:\certnew\MongoDb\Test3\test-ca.pem

authorization: enabled
clusterAuthMode: x509

Trying to connect with server Certificate:
mongosh --tls --tlsCertificateKeyFile D:\certnew\MongoDb\Test3\test-server.pem --tlsCAFile D:\certnew\MongoDb\Test3\test-ca.pem

Trying to connect with Client Certificate:
mongosh --tls --tlsCertificateKeyFile D:\certnew\MongoDb\Test3\test-client.pem --tlsCAFile D:\certnew\MongoDb\Test3\test-ca.pem

Trying to connect with x509 Auth:
mongosh --tls --tlsCertificateKeyFile D:\certnew\MongoDb\Test3\test-client.pem --tlsCAFile D:\certnew\MongoDb\Test3\test-ca.pem --authenticationDatabase ‘$external’ --authenticationMechanism MONGODB-X509

I am able to connect in all these above mentioned methods but I want only x509 authentication and other methods should not be allowed.

Hi @dheepakraj_govindarajan

Please format posts correctly for code and log extracts:

As to:

The parameter authenticationMechanisms will have to be set to MONGODB-X509 , the default is SCRAM-SHA-1, SCRAM-SHA-256 and MONGODB-X509

   authenticationMechanisms: MONGODB-X509