Skip to content

Docker Compose connection details for MongoDB is missing the authSource option when authentication is configured #35777

@ps-tunnelsoft

Description

@ps-tunnelsoft

While testing spring-boot-docker-compose (Spring Boot 3.1) I encountered an issue regarding MongoDB autoconfiguration. My Spring Boot application got an authentication error during start up. Spring Boot was using the initDB database as authentication target.

According to the official MongoDB image documentation MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD are used to create a root user in admin database and not MONGO_INITDB_DATABASE. This would require to use admin as authentication database during autoconfiguration.

The StringBuilder in class MongoDockerComposeConnectionDetailsFactory is missing the authSource option.

[scottfrederick](#35567 (comment))

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions