Skip to content

Commit

Permalink
Merge pull request #452 from rareddy/TEIID-3387
Browse files Browse the repository at this point in the history
TEIID-3387
  • Loading branch information
rareddy committed May 5, 2015
2 parents d498771 + 0b05b80 commit cfbf372
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
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 cfbf372

Please sign in to comment.