Package org.eclipse.egit.core.securestorage

Examples of org.eclipse.egit.core.securestorage.UserPasswordCredentials


    }

    final PushOperation operation = createPushOperation(calledFromRepoPage);
    if (operation == null)
      return false;
    UserPasswordCredentials credentials = repoPage.getCredentials();
    if (credentials != null)
      operation.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
          credentials.getUser(), credentials.getPassword()));
    final PushOperationResult resultToCompare;
    if (confirmPage.isShowOnlyIfChangedSelected())
      resultToCompare = confirmPage.getConfirmedResult();
    else
      resultToCompare = null;
View Full Code Here


          }
        }

        if (Protocol.HTTP.handles(finalURI)
            || Protocol.HTTPS.handles(finalURI)) {
          UserPasswordCredentials credentials = SecureStoreUtils
              .getCredentials(finalURI);
          if (credentials != null) {
            String u = credentials.getUser();
            String p = credentials.getPassword();
            String uriUser = finalURI.getUser();
            if (uriUser == null) {
              if (setSafeUser(u) && setSafePassword(p))
                setStoreInSecureStore(true);
            } else if (uriUser.length() != 0 && uriUser.equals(u)) {
View Full Code Here

   */
  public UserPasswordCredentials getCredentials() {
    if ((user == null || user.length() == 0)
        && (password == null || password.length() == 0))
      return null;
    return new UserPasswordCredentials(user, password);
  }
View Full Code Here

          false);
    else
      op = new FetchOperationUI(localDb, repoSelection.getURI(false),
          refSpecPage.getRefSpecs(), timeout, false);

    UserPasswordCredentials credentials = repoPage.getCredentials();
    if (credentials != null)
      op.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
          credentials.getUser(), credentials.getPassword()));

    // even if a RemoteConfig is selected, we need to make sure to
    // add the RefSpecs from the RefSpec page into the FetchOperation
    if (!calledFromRepoPage)
      op.setTagOpt(refSpecPage.getTagOpt());
View Full Code Here

   * @return if clone was successful
   * @throws URISyntaxException
   */
  protected boolean performClone(GitRepositoryInfo gitRepositoryInfo) throws URISyntaxException {
    URIish uri = new URIish(gitRepositoryInfo.getCloneUri());
    UserPasswordCredentials credentials = gitRepositoryInfo.getCredentials();
    setWindowTitle(NLS.bind(UIText.GitCloneWizard_jobName, uri.toString()));
    final boolean allSelected;
    final Collection<Ref> selectedBranches;
    if (validSource.isSourceRepoEmpty()) {
      // fetch all branches of empty repo
      allSelected = true;
      selectedBranches = Collections.emptyList();
    } else {
      allSelected = validSource.isAllSelected();
      selectedBranches = validSource.getSelectedBranches();
    }
    final File workdir = cloneDestination.getDestinationFile();
    final Ref ref = cloneDestination.getInitialBranch();
    final String remoteName = cloneDestination.getRemote();

    boolean created = workdir.exists();
    if (!created)
      created = workdir.mkdirs();

    if (!created || !workdir.isDirectory()) {
      final String errorMessage = NLS.bind(
          UIText.GitCloneWizard_errorCannotCreate, workdir.getPath());
      ErrorDialog.openError(getShell(), getWindowTitle(),
          UIText.GitCloneWizard_failed, new Status(IStatus.ERROR,
              Activator.getPluginId(), 0, errorMessage, null));
      // let's give user a chance to fix this minor problem
      return false;
    }

    int timeout = Activator.getDefault().getPreferenceStore()
        .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
    final CloneOperation op = new CloneOperation(uri, allSelected,
        selectedBranches, workdir, ref != null ? ref.getName() : null,
        remoteName, timeout);
    if (credentials != null)
      op.setCredentialsProvider(new EGitCredentialsProvider(
          credentials.getUser(), credentials.getPassword()));
    else
      op.setCredentialsProvider(new EGitCredentialsProvider());
    op.setCloneSubmodules(cloneDestination.isCloneSubmodules());

    configureFetchSpec(op, gitRepositoryInfo, remoteName);
View Full Code Here

  /**
   * @param user
   * @param password
   */
  public void setCredentials(String user, String password) {
    credentials = new UserPasswordCredentials(user, password);
  }
View Full Code Here

  /**
   * @param user the user name needed to log in
   * @param password  the password needed to log in
   */
  public void setCredentials(String user, String password) {
    credentials = new UserPasswordCredentials(user, password);
  }
View Full Code Here

  }

  @Override
  protected void okPressed() {
    if (user.getText().length() > 0) {
      credentials = new UserPasswordCredentials(user.getText(),
          password.getText());
      if(!changeCredentials)
        storeInSecureStore = storeCheckbox.getSelection();
    }
    super.okPressed();
View Full Code Here

   * @return credentials, <code>null</code> if the user canceled the dialog.
   */
  public static UserPasswordCredentials login(Shell parent, URIish uri) {
    LoginDialog dialog = new LoginDialog(parent, uri);
    if (dialog.open() == Window.OK) {
      UserPasswordCredentials credentials = dialog.getCredentials();
      if (credentials != null && dialog.getStoreInSecureStore())
        SecureStoreUtils.storeCredentials(credentials, uri);
      return credentials;
    }
    return null;
View Full Code Here

   */
  public static UserPasswordCredentials changeCredentials(Shell parent,
      URIish uri) {
    LoginDialog dialog = new LoginDialog(parent, uri);
    dialog.setChangeCredentials(true);
    UserPasswordCredentials oldCredentials = SecureStoreUtils
        .getCredentialsQuietly(uri);
    if (oldCredentials != null)
      dialog.setOldUser(oldCredentials.getUser());
    if (dialog.open() == Window.OK) {
      UserPasswordCredentials credentials = dialog.getCredentials();
      if (credentials != null)
        SecureStoreUtils.storeCredentials(credentials, uri);
      return credentials;
    }
    return null;
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.securestorage.UserPasswordCredentials

Copyright © 2018 www.massapicom. 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.