Java MongoDB Client: authentication failed when access to a server not configured to use an authentication

Michael

I have configured Java MongoDB Client to use MongoCredential. Unfortunately when I access to a server that does not configured to use an authentication I get authentication failed exception:

Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server …. The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }

I do expect this exception when a server is configured to use an authentication and when Java MongoDB Client but not in this case.

Is it possible to configure Java MongoDB Client not to fail when access to a server not configured to use an authentication?

sergiuz

I am afraid not, your client does not know whether the server has auth enabed or not.
Your client connection code should match the auth parameters from the server, otherwise it fails.

What I did in this case, was to create a connection function which accepts auth credentials, when credentials are passed, used them - create the connection with auth credentials, otherwise no - create the connection with no auth credentials.

In this case, you should know what server has auth enabled

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java MongoDB Client: authentication failed when access to a server not configured to use an authentication

From Dev

Golang and MongoDb remote access fail (server returned error on SASL authentication step: Authentication failed.)

From Dev

PayPal Client Authentication Failed

From Dev

MongoDB 3.2 authentication failed

From Dev

MongoDB authentication failed?

From Dev

WebOS Error: All configured authentication methods failed

From Dev

Client authentication on JBoss server

From Dev

Client received SOAP Fault from server: Authentication failed ebay

From Dev

Failed to start Apache Server after configuring Client Authentication

From Dev

Fatal: authentication failed for [GIT client]

From Dev

Mongolab Authentication Failed Java

From Dev

Client Certificate authentication in Java

From Dev

MongoDB-CR Authentication failed

From Dev

Configuring MongoDB connector in MuleStudio when authentication is disabled - "failed to connect" error

From Dev

Client/server username/password authentication

From Dev

Force MS Access ODBC Connection to use SQL Server Authentication

From Dev

MongoDB Authentication not enabled on Linux Server

From Dev

Force Laravel to use MySQL for authentication when MongoDB is set as default

From Dev

Window's Authentication to access server

From Dev

Authentication during connection to MongoDB server instance using Java

From Dev

paypal client authentication failed while going live

From Dev

paypal client authentication failed while going live

From Dev

Client Authentication by Certificate in GAE java

From Dev

Java HTTPServer Authentication - Client Side

From Dev

This driver is not configured for integrated authentication

From Java

server returned error on SASL authentication step: Authentication failed

From Dev

Access AuthSession on client after authentication on ServiceStack Services

From Dev

In the Jetty server how can I obtain the client certificate used when client authentication is required?

From Dev

How to fix Google Maps "Authentication failed on the server"?

Related Related

  1. 1

    Java MongoDB Client: authentication failed when access to a server not configured to use an authentication

  2. 2

    Golang and MongoDb remote access fail (server returned error on SASL authentication step: Authentication failed.)

  3. 3

    PayPal Client Authentication Failed

  4. 4

    MongoDB 3.2 authentication failed

  5. 5

    MongoDB authentication failed?

  6. 6

    WebOS Error: All configured authentication methods failed

  7. 7

    Client authentication on JBoss server

  8. 8

    Client received SOAP Fault from server: Authentication failed ebay

  9. 9

    Failed to start Apache Server after configuring Client Authentication

  10. 10

    Fatal: authentication failed for [GIT client]

  11. 11

    Mongolab Authentication Failed Java

  12. 12

    Client Certificate authentication in Java

  13. 13

    MongoDB-CR Authentication failed

  14. 14

    Configuring MongoDB connector in MuleStudio when authentication is disabled - "failed to connect" error

  15. 15

    Client/server username/password authentication

  16. 16

    Force MS Access ODBC Connection to use SQL Server Authentication

  17. 17

    MongoDB Authentication not enabled on Linux Server

  18. 18

    Force Laravel to use MySQL for authentication when MongoDB is set as default

  19. 19

    Window's Authentication to access server

  20. 20

    Authentication during connection to MongoDB server instance using Java

  21. 21

    paypal client authentication failed while going live

  22. 22

    paypal client authentication failed while going live

  23. 23

    Client Authentication by Certificate in GAE java

  24. 24

    Java HTTPServer Authentication - Client Side

  25. 25

    This driver is not configured for integrated authentication

  26. 26

    server returned error on SASL authentication step: Authentication failed

  27. 27

    Access AuthSession on client after authentication on ServiceStack Services

  28. 28

    In the Jetty server how can I obtain the client certificate used when client authentication is required?

  29. 29

    How to fix Google Maps "Authentication failed on the server"?

HotTag

Archive