Package org.eclipse.mylyn.commons.net

Examples of org.eclipse.mylyn.commons.net.AuthenticationCredentials


    return repository.getProperty(IRedmineConstants.REPOSITORY_SETTING_API_KEY);
  }

  @Override
  public Credentials getRepositoryCredentials() {
    AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
   
   
    if(credentials!=null && !credentials.getUserName().isEmpty()) {
      try {
        URL url = new URL(location.getUrl());

        String host = url.getHost();
        String username = credentials.getUserName();
        String password = credentials.getPassword();
       
        Credentials httpCredentials = new UsernamePasswordCredentials(username, password);
        int i = username.indexOf("\\"); //$NON-NLS-1$
        if (i > 0 && i < username.length() - 1 && host != null) {
          httpCredentials = new NTCredentials(username.substring(i + 1), password, host, username.substring(0, i));
View Full Code Here


     * @param taskRepository the task repository
     * @throws CoreException if the login fails
     */
    GDataGoogleCodeClient(TaskRepository taskRepository) throws CoreException {
        this.projectHostingService = new ProjectHostingService("googlecode-mylyn-connector");
        AuthenticationCredentials credentials = taskRepository.getCredentials(AuthenticationType.REPOSITORY);
        if (credentials != null) {
            //not anonymous
            try {
                this.projectHostingService.setUserCredentials(credentials.getUserName(),
                        credentials.getPassword());
            } catch (AuthenticationException e) {
                Status status = new Status(IStatus.ERROR, GoogleCodeCorePlugin.PLUGIN_ID, "invalid credentials", e);
                throw new CoreException(status);
            }
        }
View Full Code Here

    public static boolean isLoggedIn(TaskRepository repository) {
        if (StringUtils.isEmpty(repository.getUserName())) {
            return false;
        }
        AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
        return credentials != null && !StringUtils.isEmpty(credentials.getPassword());
    }
View Full Code Here

          } catch (RedmineStatusException e) {
            RedmineUiPlugin.getLogService(getClass()).error(e, "Can't fetch repository configuration"); //$NON-NLS-1$
          }
        }
       
        AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
        if (credentials != null && credentials.getUserName().length() > 0) {
          currentUser = credentials.getUserName();
        }
      }
    }
  }
View Full Code Here

          }
          monitor.worked(100);
         
          String user = urlMatcher.group(1);
          String repo = urlMatcher.group(2);
          AuthenticationCredentials auth = repository.getCredentials(AuthenticationType.REPOSITORY);
         
          GitHubService service = new GitHubService();
 
          monitor.subTask("Contacting server...");
          try {
            // verify the repo
            service.searchIssues(user, repo, new String("open"),"");
            monitor.worked(400);
           
            // verify the credentials
            if (auth == null) {
              setStatus(GitHubUi.createErrorStatus("Credentials are required.  Please specify username and API Token."));
              return;
            }
            GitHubCredentials credentials = new GitHubCredentials(auth.getUserName(), auth.getPassword());
            if (!service.verifyCredentials(credentials)) {
              setStatus(GitHubUi.createErrorStatus("Invalid credentials.  Please check your GitHub User ID and API Token.\nYou can find your API Token on your GitHub account settings page."));
              return
            }
          } catch (GitHubServiceException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.mylyn.commons.net.AuthenticationCredentials

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.