Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization does not respect spring boot properties spring.data.mongodb.authentication-database #4396

Closed
sunny-chung opened this issue May 27, 2023 · 1 comment
Labels
for: external-project For an external project and not something we can fix

Comments

@sunny-chung
Copy link

I am using org.springframework.boot:spring-boot-starter-data-mongodb:3.1.0 with reactive repositories and MongoDB 6.0.6.

When below application.yml is supplied to Spring Boot:

spring:
  data:
    mongodb:
      host: mongo:27017
      username: username
      password: password
      authentication-database: admin
      database: other

Spring Data MongoDB always connects to "other" database for authorization when a query is performed, while expected behaviour is to connect to "admin" as configured above. The configuration spring.data.mongodb.authentication-database is ignored. This issue can also be observed in Spring Data MongoDB logging.

Exception Log:

org.springframework.data.mongodb.UncategorizedMongoDbException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-256, userName='username', source='other', password=<hidden>, mechanismProperties=<hidden>}
        at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:140) ~[spring-data-mongodb-4.1.0.jar!/:4.1.0]
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
...
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2023
@mp911de
Copy link
Member

mp911de commented May 30, 2023

This is a Spring Boot issue. It seems to be a duplicate of spring-projects/spring-boot#35566. Can you verify this? If it is not a duplicate, please file a ticket against Spring Boot.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2023
@mp911de mp911de added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants