Examples of AuthenticationCredentials


Examples of com.netflix.astyanax.AuthenticationCredentials

    int port = cpConfig.getPort();
    int protocolVersion = -1; // use default
   
    AuthProvider authProvider = AuthProvider.NONE;
   
    AuthenticationCredentials creds = cpConfig.getAuthenticationCredentials();
    if (creds != null) {
      authProvider = new PlainTextAuthProvider(creds.getUsername(), creds.getPassword());
    }
   
    return new ProtocolOptions(port, protocolVersion, null, authProvider);
  }
View Full Code Here

Examples of com.netflix.astyanax.AuthenticationCredentials

                    transport.open();

                cassandraClient = new Cassandra.Client(new TBinaryProtocol.Factory().getProtocol(transport));
                monitor.incConnectionCreated(getHost());

                AuthenticationCredentials credentials = cpConfig.getAuthenticationCredentials();
                if (credentials != null) {
                    Map<String, String> thriftCredentials = Maps.newHashMapWithExpectedSize(2);
                    thriftCredentials.put("username", credentials.getUsername());
                    thriftCredentials.put("password", credentials.getPassword());
                    cassandraClient.login(new AuthenticationRequest(thriftCredentials));
                }
            }
            catch (Exception e) {
                pool.addLatencySample(TimeUnit.NANOSECONDS.convert(cpConfig.getSocketTimeout(), TimeUnit.MILLISECONDS), System.nanoTime());
View Full Code Here

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

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

     * @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

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

    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

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

          } 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

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

          }
          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

Examples of org.platformlayer.model.AuthenticationCredentials

  //
  // authenticatedScope.put(OpsAuthentication.class, opsAuthentication);
  // }

  protected AuthenticationCredentials findCredentials(HttpServletRequest httpRequest) throws Exception {
    AuthenticationCredentials creds = null;

    final String authToken = httpRequest.getHeader("X-Auth-Token");
    if (authToken != null) {
      creds = new AuthenticationCredentials() {
        @Override
        public AuthenticationToken getToken() {
          return new PlatformlayerAuthenticationToken(authToken);
        }
      };
View Full Code Here

Examples of org.platformlayer.model.AuthenticationCredentials

    if (servletRequest instanceof HttpServletRequest) {
      HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
      HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;

      try {
        AuthenticationCredentials credentials = findCredentials(httpServletRequest);

        // if (authenticated == null) {
        // httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        // return;
        // } else {
View Full Code Here

Examples of org.platformlayer.model.AuthenticationCredentials

  AuthenticationTokenValidator authenticationTokenValidator;

  protected AuthenticationCredentials findCredentials(HttpServletRequest httpRequest) throws Exception {
    final String authToken = httpRequest.getHeader("X-Auth-Token");
    if (authToken != null) {
      AuthenticationCredentials creds = new PlatformLayerAuthenticationCredentials(authToken);
      return creds;
    }

    X509Certificate[] certChain = (X509Certificate[]) httpRequest
        .getAttribute("javax.servlet.request.X509Certificate");
    if (certChain != null && certChain.length != 0) {
      AuthenticationCredentials creds = new CertificateAuthenticationCredentials(certChain);
      return creds;
    }

    return null;
  }
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.