0

Already tried with MongoClient for no authentication connection String which is as below but is not working for LDAP authentication

MongoClient client = new MongoClient("mongodb://username:pass@localhost/portnumbr")

Is there any connection string to connect to Mongo Db using parasoft tool or Java which has LDAP authentication

SF..MJ
  • 862
  • 8
  • 19
Dev
  • 1
  • 1

1 Answers1

0

Dev,

here is example for Java from MongoDB examples using LDAP (PLAIN):

String user;          // The LDAP user name
char[] password;      // The LDAP password
// ...
MongoCredential credential = MongoCredential.createPlainCredential(user, "$external", password);
MongoClient mongoClient = new MongoClient(new ServerAddress("host1", 27017), credential);

or just create connection with parameters explicitly:

MongoClientURI uri = new MongoClientURI("mongodb://user1@host1/?authSource=$external&authMechanism=PLAIN");

In MongoDB Query Tool from Parasoft SOAtest you can also define that you want to use LDAP. Check option "Authentication Mechanism" and set it to use LDAP. You may need to use domain name and user name for connection ie: MY_DOMAIN\user_name

You should be aware that some authentication mechanisms are only available in MongoDB Enterprise Edition.