Skip to content

mongo:mongo-client namespace does not support usernames with a comma [DATAMONGO-1257] #2175

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

Closed
spring-projects-issues opened this issue Jul 20, 2015 · 5 comments
Assignees
Labels
type: bug A general bug

Comments

@spring-projects-issues
Copy link

John Mark opened DATAMONGO-1257 and commented

When using a mongo database with X-509 authentication, the username of the user is the subject DN from the X-509 certificate (see http://docs.mongodb.org/manual/tutorial/configure-x509-client-authentication/). The subject DN usually contains commas in it. This causes problems with trying to setup the mongo client using the mongo:mongo-client namespace with xml configuration since it expects credentials to be a comma separated list of usernames and splits on comma (,)

Another problem is that the credential is expected to be in username:password@database format, but when using X-509 authentication there is no password.

A third issue that I noticed was that there seems to be a bug in
org.springframework.data.mongodb.config.MongoCredentialPropertyEditor since when it checks for the presence of : and @ in the property, it does so on the original property, not the split string, which can cause NPEs if the colon or @ exists in the property but not on each split


Affects: 1.7.1 (Fowler SR1)

Referenced from: pull request #310

Backported to: 1.7.2 (Fowler SR2)

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

Good catch, John. Any chance you provide an – of course anonymized – authentication String that you're passing into credentials and expect to do the "right thing"™?

@spring-projects-issues
Copy link
Author

Christoph Strobl commented

we could use ' to prevent the split and group things.

credentials="'CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry@stark?uri.authMechanism=MONGODB-X509'"

@spring-projects-issues
Copy link
Author

John Mark commented

Oliver, Christoph's example pretty much matches the pattern of what my authentication String should look like. I think using the ' to prevent the split should work nicely. Just make sure that it is documented somewhere

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

I've merged Christoph's PR and added a hint to the quoting mechanism in the XSD for the 1.7 and 1.8 versions

@spring-projects-issues
Copy link
Author

John Mark commented

Oliver, Christoph, thanks for fixing this in a timely manner, I appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants