List of usage examples for com.mongodb MongoCredential createGSSAPICredential
public static MongoCredential createGSSAPICredential(final String userName)
From source file:org.wso2.carbon.datasource.reader.mongo.MongoDataSourceReaderUtil.java
License:Open Source License
private static MongoCredential createCredentials(MongoDataSourceConfiguration fileConfig) { MongoCredential credential;//from ww w . j a v a 2s . com switch (fileConfig.getAuthenticationMethodEnum()) { case SCRAM_SHA_1: credential = MongoCredential.createScramSha1Credential(fileConfig.getUsername(), fileConfig.getDatabase(), fileConfig.getPassword().toCharArray()); break; case MONGODB_CR: credential = MongoCredential.createMongoCRCredential(fileConfig.getUsername(), fileConfig.getDatabase(), fileConfig.getPassword().toCharArray()); case LDAP_PLAIN: credential = MongoCredential.createPlainCredential(fileConfig.getUsername(), fileConfig.getAuthSource(), fileConfig.getPassword().toCharArray()); case X_509: credential = MongoCredential.createMongoX509Credential(fileConfig.getUsername()); case GSSAPI: credential = MongoCredential.createGSSAPICredential(fileConfig.getUsername()); case DEFAULT: default: credential = MongoCredential.createCredential(fileConfig.getUsername(), fileConfig.getDatabase(), fileConfig.getPassword().toCharArray()); } return credential; }