You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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"™?
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
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 expectscredentials
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 splitAffects: 1.7.1 (Fowler SR1)
Referenced from: pull request #310
Backported to: 1.7.2 (Fowler SR2)
The text was updated successfully, but these errors were encountered: