Example usage for com.mongodb AuthenticationMechanism MONGODB_CR

List of usage examples for com.mongodb AuthenticationMechanism MONGODB_CR

Introduction

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

Prototype

AuthenticationMechanism MONGODB_CR

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

Click Source Link

Document

The MongoDB Challenge Response 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.  jav  a  2  s  . com
        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. j  av  a 2 s  . c  om*/
    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  w  ww.  j a v  a  2 s . c  o m
        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 ww. j  a  v  a  2  s .c  o m*/
    return null;
}