Example usage for com.mongodb AuthenticationMechanism SCRAM_SHA_1

List of usage examples for com.mongodb AuthenticationMechanism SCRAM_SHA_1

Introduction

In this page you can find the example usage for com.mongodb AuthenticationMechanism SCRAM_SHA_1.

Prototype

AuthenticationMechanism SCRAM_SHA_1

To view the source code for com.mongodb AuthenticationMechanism SCRAM_SHA_1.

Click Source Link

Document

The SCRAM-SHA-1 mechanism.

Usage

From source file:org.codinjutsu.tools.mongo.view.ServerConfigurationPanel.java

License:Apache License

public void loadConfigurationData(ServerConfiguration configuration) {
    labelField.setText(configuration.getLabel());
    serverUrlsField.setText(StringUtils.join(configuration.getServerUrls(), ","));
    usernameField.setText(configuration.getUsername());
    passwordField.setText(configuration.getPassword());
    userDatabaseField.setText(configuration.getUserDatabase());
    authenticationDatabaseField.setText(configuration.getAuthenticationDatabase());
    sslConnectionField.setSelected(configuration.isSslConnection());
    readPreferenceComboBox.setSelectedItem(configuration.getReadPreference());
    collectionsToIgnoreField.setText(StringUtils.join(configuration.getCollectionsToIgnore(), ","));
    shellArgumentsLineField.setText(configuration.getShellArgumentsLine());
    shellWorkingDirField.setText(configuration.getShellWorkingDir());
    autoConnectCheckBox.setSelected(configuration.isConnectOnIdeStartup());

    AuthenticationMechanism authentificationMethod = configuration.getAuthenticationMechanism();
    if (AuthenticationMechanism.MONGODB_CR.equals(authentificationMethod)) {
        mongoCRAuthRadioButton.setSelected(true);
    } else if (AuthenticationMechanism.SCRAM_SHA_1.equals(authentificationMethod)) {
        scramSHA1AuthRadioButton.setSelected(true);
    } else {/*from w  w w  .j av a 2s  . co  m*/
        defaultAuthMethodRadioButton.setSelected(true);
    }
}

From source file:org.codinjutsu.tools.mongo.view.ServerConfigurationPanel.java

License:Apache License

private AuthenticationMechanism getAuthenticationMethod() {
    if (mongoCRAuthRadioButton.isSelected()) {
        return AuthenticationMechanism.MONGODB_CR;
    } else if (scramSHA1AuthRadioButton.isSelected()) {
        return AuthenticationMechanism.SCRAM_SHA_1;
    }/*from w  w w.  ja  v a2  s  . c o  m*/
    return null;
}

From source file:org.codinjutsu.tools.nosql.mongo.view.MongoAuthenticationPanel.java

License:Apache License

@Override
public void load(AuthenticationSettings settings) {
    usernameField.setText(settings.getUsername());
    passwordField.setText(settings.getPassword());
    MongoExtraSettings mongoExtraSettings = new MongoExtraSettings(settings.getExtras());
    authenticationDatabaseField.setText(mongoExtraSettings.getAuthenticationDatabase());
    sslConnectionField.setSelected(mongoExtraSettings.isSsl());
    AuthenticationMechanism authentificationMethod = mongoExtraSettings.getAuthenticationMechanism();
    if (AuthenticationMechanism.MONGODB_CR.equals(authentificationMethod)) {
        mongoCRAuthRadioButton.setSelected(true);
    } else if (AuthenticationMechanism.SCRAM_SHA_1.equals(authentificationMethod)) {
        scramSHA1AuthRadioButton.setSelected(true);
    } else {//from www. ja va  2s .c om
        defaultAuthMethodRadioButton.setSelected(true);
    }
}

From source file:org.codinjutsu.tools.nosql.mongo.view.MongoAuthenticationPanel.java

License:Apache License

private AuthenticationMechanism getAuthenticationMechanism() {
    if (mongoCRAuthRadioButton.isSelected()) {
        return AuthenticationMechanism.MONGODB_CR;
    } else if (scramSHA1AuthRadioButton.isSelected()) {
        return AuthenticationMechanism.SCRAM_SHA_1;
    }// w  w w .java2 s.com
    return null;
}