Skip to content

Commit

Permalink
TEIID-3387
Browse files Browse the repository at this point in the history
  • Loading branch information
rareddy committed May 5, 2015
1 parent d498771 commit 0b05b80
Showing 1 changed file with 11 additions and 4 deletions.
Expand Up @@ -93,20 +93,27 @@ private MongoCredential getCredential() {

MongoCredential credential = null;
if (this.securityType.equals(SecurityType.SCRAM_SHA_1.name())) {
credential = MongoCredential.createScramSha1Credential(this.username, this.authDatabase, this.password.toCharArray());
credential = MongoCredential.createScramSha1Credential(this.username,
(this.authDatabase == null) ? this.database: this.authDatabase,
this.password.toCharArray());
}
else if (this.securityType.equals(SecurityType.MONGODB_CR.name())) {
credential = MongoCredential.createMongoCRCredential(this.username, this.authDatabase, this.password.toCharArray());
credential = MongoCredential.createMongoCRCredential(this.username,
(this.authDatabase == null) ? this.database: this.authDatabase,
this.password.toCharArray());
}
else if (this.securityType.equals(SecurityType.Kerberos.name())) {
credential = MongoCredential.createGSSAPICredential(this.username);
}
else if (this.securityType.equals(SecurityType.X509.name())) {
credential = MongoCredential.createMongoX509Credential(this.username);
}
else if (MongoDBManagedConnectionFactory.this.username != null && MongoDBManagedConnectionFactory.this.password != null) {
else if (this.username != null && this.password != null) {
// to support legacy pre-3.0 authentication
credential = MongoCredential.createMongoCRCredential(MongoDBManagedConnectionFactory.this.username, MongoDBManagedConnectionFactory.this.database, MongoDBManagedConnectionFactory.this.password.toCharArray());
credential = MongoCredential.createMongoCRCredential(
MongoDBManagedConnectionFactory.this.username,
(this.authDatabase == null) ? this.database: this.authDatabase,
this.password.toCharArray());
}
return credential;
}
Expand Down

0 comments on commit 0b05b80

Please sign in to comment.