Examples of UserCredentials


Examples of org.springframework.data.authentication.UserCredentials

   * @throws UnknownHostException
   * @see MongoURI
   */
  @SuppressWarnings("deprecation")
  public SimpleMongoDbFactory(MongoURI uri) throws MongoException, UnknownHostException {
    this(new Mongo(uri), uri.getDatabase(), new UserCredentials(uri.getUsername(), parseChars(uri.getPassword())),
        true, uri.getDatabase());
  }
View Full Code Here

Examples of org.springframework.data.authentication.UserCredentials

  public void setAuthenticationDatabaseName(String authenticationDatabaseName) {
    this.authenticationDatabaseName = authenticationDatabaseName;
  }

  DB getDB(String databaseName) {
    return MongoDbUtils.getDB(mongo, databaseName, new UserCredentials(username, password), authenticationDatabaseName);
  }
View Full Code Here

Examples of org.springframework.data.authentication.UserCredentials

    }
    return result;
  }

  public DB getDb(String databaseName) {
    return MongoDbUtils.getDB(mongo, databaseName, new UserCredentials(username, password));
  }
View Full Code Here

Examples of org.springframework.data.authentication.UserCredentials

  public void mongoUriConstructor() throws UnknownHostException {

    MongoURI mongoURI = new MongoURI("mongodb://myUsername:myPassword@localhost/myDatabase.myCollection");
    MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(mongoURI);

    assertThat(ReflectionTestUtils.getField(mongoDbFactory, "credentials"), is((Object) new UserCredentials(
        "myUsername", "myPassword")));
    assertThat(ReflectionTestUtils.getField(mongoDbFactory, "databaseName").toString(), is("myDatabase"));
    assertThat(ReflectionTestUtils.getField(mongoDbFactory, "databaseName").toString(), is("myDatabase"));
  }
View Full Code Here

Examples of org.springframework.data.authentication.UserCredentials

    expect(uri.getPassword()).andReturn(pass);
    expect(uri.getDatabase()).andReturn(database);

    Mongo mongo = createMock(Mongo.class);

    UserCredentials credentials =
        new UserCredentials(user, String.valueOf(pass));
    MongoDbFactory mongoDbFactory =
        PowerMock
            .createMockAndExpectNew(SimpleMongoDbFactory.class, mongo,
                database, credentials);
View Full Code Here

Examples of org.springframework.data.authentication.UserCredentials

    char[] password = uri.getPassword();
    if (Strings.isNullOrEmpty(username)) {
      return new SimpleMongoDbFactory(mongo, uri.getDatabase());
    }
    return new SimpleMongoDbFactory(mongo, uri.getDatabase(),
        new UserCredentials(username, password == null ? null
            : String.valueOf(password)));
  }
View Full Code Here

Examples of qubexplorer.UserCredentials

        authentication=null;
        setVisible(false);
    }//GEN-LAST:event_cancelButtonActionPerformed

    private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed
        authentication=new UserCredentials(usernameField.getText(), passwordField.getPassword());
        setVisible(false);
    }//GEN-LAST:event_acceptButtonActionPerformed
View Full Code Here

Examples of qubexplorer.UserCredentials

    public static UserCredentials showAuthDialog(Frame frame) {
        AuthDialog authDialog = new AuthDialog(frame, true);
        authDialog.setLocationRelativeTo(frame);
        authDialog.setVisible(true);
        UserCredentials auth = authDialog.getAuthentication();
        authDialog.dispose();
        return auth;
    }
View Full Code Here

Examples of qubexplorer.UserCredentials

public class AuthenticationRepositoryTest {
   
    @Test
    public void shouldContaintAuthentication(){
        AuthenticationRepository repo=AuthenticationRepository.getInstance();
        UserCredentials auth=new UserCredentials("one", "two".toCharArray());
        repo.saveAuthentication("url", "key", auth);
        assertThat(repo.getAuthentication("url", "key"), is(auth));
        assertThat(repo.getAuthentication("url", "key2"), is(auth));
        UserCredentials auth2=new UserCredentials("one", "two".toCharArray());
        repo.saveAuthentication("url2", null, auth2);
        assertThat(repo.getAuthentication("url2", "key"), is(auth2));
        assertThat(repo.getAuthentication("url2", "key2"), is(auth2));
        assertNull(repo.getAuthentication("url3", "key2"));
    }
View Full Code Here

Examples of qubexplorer.UserCredentials

    @Mock
    private AuthenticationRepository repository;

    @Before
    public void init() {
        when(repository.getAuthentication(anyString(), anyString())).thenReturn(new UserCredentials("username", new char[0]));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.