selectAuthenticationMechanism method

void selectAuthenticationMechanism(
  1. String authenticationSchemeName
)

Implementation

void selectAuthenticationMechanism(String authenticationSchemeName) {
  if (authenticationSchemeName == ScramSha1Authenticator.name) {
    _authenticationScheme = AuthenticationScheme.SCRAM_SHA_1;
  } else if (authenticationSchemeName == ScramSha256Authenticator.name) {
    _authenticationScheme = AuthenticationScheme.SCRAM_SHA_256;
  } else if (authenticationSchemeName == MongoDbCRAuthenticator.name) {
    _authenticationScheme = AuthenticationScheme.MONGODB_CR;
  } else if (authenticationSchemeName == X509Authenticator.name) {
    _authenticationScheme = AuthenticationScheme.X509;
    authSourceDb = Db._authDb(r'$external');
  } else {
    throw MongoDartError('Provided authentication scheme is '
        'not supported : $authenticationSchemeName');
  }
}