Returns a List of Pair<key, value> which contains the git credentials to use.
Key - url to repository
Value - StandardCredentials, containing username and password
432019
private List<Pair<String, StandardCredentials>> getGitClientCredentials() {
        List<Pair<String, StandardCredentials>> credentialsList = new ArrayList<>();
        GitSCM gitScm = getJenkinsScm();
        for (UserRemoteConfig uc : gitScm.getUserRemoteConfigs()) {
            String url = uc.getUrl();
            // In case overriding credentials are defined, we will use it for this URL
            if (this.credentials != null) {
                credentialsList.add(Pair.of(url, this.credentials));
                continue;
            }

            // Get credentials from jenkins credentials plugin
            if (uc.getCredentialsId() != null) {
                StandardUsernameCredentials credentials = CredentialsMatchers.firstOrNull(
                                CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class,
                                        build.getProject(), ACL.SYSTEM, URIRequirementBuilder.fromUri(url).build()),
                                CredentialsMatchers.allOf(CredentialsMatchers.withId(uc.getCredentialsId()),
                                        GitClient.CREDENTIALS_MATCHER));
                if (credentials != null) {
                    credentialsList.add(Pair.of(url, (StandardCredentials)credentials));
                }
            }
        }
        return credentialsList;
    }
52155
public Credentials toGrgit() {
        if (username != null && password != null) {
            return new Credentials(username, password);
        } else {
            return null;
        }
    }
1157383
def get_repo_keys():
    '''
    
    '''
    ret = dict()
    repo_keys = list()

    # The double usage of '--with-fingerprint' is necessary in order to
    # retrieve the fingerprint of the subkey.
    cmd = ['apt-key', 'adv', '--batch', '--list-public-keys', '--with-fingerprint',
           '--with-fingerprint', '--with-colons', '--fixed-list-mode']

    cmd_ret = _call_apt(cmd, scope=False)

    if cmd_ret['retcode'] != 0:
        log.error(cmd_ret['stderr'])
        return ret

    lines = [line for line in cmd_ret['stdout'].splitlines() if line.strip()]

    # Reference for the meaning of each item in the colon-separated
    # record can be found here: https://goo.gl/KIZbvp
    for line in lines:
        items = [_convert_if_int(item.strip()) if item.strip() else None for item in line.split(':')]
        key_props = dict()

        if len(items) < 2:
            log.debug('Skipping line: %s', line)
            continue

        if items[0] in ('pub', 'sub'):
            key_props.update({
                'algorithm': items[3],
                'bits': items[2],
                'capability': items[11],
                'date_creation': items[5],
                'date_expiration': items[6],
                'keyid': items[4],
                'validity': items[1]
            })

            if items[0] == 'pub':
                repo_keys.append(key_props)
            else:
                repo_keys[-1]['subkey'] = key_props
        elif items[0] == 'fpr':
            if repo_keys[-1].get('subkey', False):
                repo_keys[-1]['subkey'].update({'fingerprint': items[9]})
            else:
                repo_keys[-1].update({'fingerprint': items[9]})
        elif items[0] == 'uid':
            repo_keys[-1].update({
                'uid': items[9],
                'uid_hash': items[7]
            })

    for repo_key in repo_keys:
        ret[repo_key['keyid']] = repo_key
    return ret
81291
def access_key(self):
        
        credential = self.query_parameters.get(_x_amz_credential)
        if credential is not None:
            credential = url_unquote(credential[0])
        else:
            credential = self.authorization_header_parameters.get(_credential)

            if credential is None:
                raise AttributeError("Credential was not passed in the request")
        try:
            key, scope = credential.split("/", 1)
        except ValueError:
            raise AttributeError("Invalid request credential: %r" % credential)

        if scope != self.credential_scope:
            raise AttributeError("Incorrect credential scope: %r (wanted %r)" %
                                 (scope, self.credential_scope))

        return key
257993
public List<GitlabSSHKey> getSSHKeys(Integer targetUserId) throws IOException {
        String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL;
        return Arrays.asList(retrieve().to(tailUrl, GitlabSSHKey[].class));
    }
388123
function getUserCredentials() {
  return new Promise((resolve) => {
    print(clc.bold('Sign in to authorize this app to find open pull-requests'), true);
    gitUser.email((err, email) => {
      prompt.message = '';
      prompt.delimiter = '';
      prompt.start();
      prompt.get({
        properties: {
          username: {
            description: 'Github username',
            default: email,
            message: 'Name must be only letters, spaces, or dashes',
            required: true
          },
          password: {
            description: 'Github password',
            hidden: true
          }
        }
      }, (err, result) => {
        resolve(result);
      });
    });
  });
}
62687
def credentials(username, password, digest = false)
      self.username = username
      self.password = password
      self.digest = digest
    end
1247470
def credentials
      return @credentials if @credentials
      output = %x"#{@command} #{@name}".lines

      password = output.shift
      username = output.find { |line| line.start_with? 'Username:' }.split(":").pop.strip
      @credentials = {:username => username, :password => password}
    end
959887
@SuppressWarnings("unchecked")
    protected Credentials getCredentials(Map<String, String> credentials) {
        Credentials credential = null;
        if (credentials != null && credentials.containsKey(getCredentialKey())) {
            try {
                byte[] credBytes = DatatypeConverter.parseBase64Binary(credentials.get(getCredentialKey()));
                ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(credBytes));

                credential = new Credentials();
                credential.readFields(in);
            } catch (Exception e) {
                LOG.error("Could not obtain credentials from credentials map.", e);
            }
        }
        return credential;
    }
210080
def retrieve
      raise RetrieverError.new("git retriever is unavailable") unless available?
      private_key = @repository.first_credential
      private_key = nil if private_key && private_key.empty?
      if is_windows?
        if private_key
          with_private_key_windows(private_key) { super }
        else
          super
        end
      else
        # always start the ssh agent in Linux so we can disable strict host name
        # checking, regardless of credentials.
        ::RightScraper::Processes::SSHAgent.with do |agent|
          agent.add_key(private_key) if private_key
          super
        end
      end
      true
    end
498067
def repo_values(self):
        
        branches = []
        commits = {}
        m_helper = Tools()
        status = m_helper.repo_branches(self.parentApp.repo_value['repo'])
        # branches and commits must both be retrieved successfully
        if status[0]:
            branches = status[1]
            status = m_helper.repo_commits(self.parentApp.repo_value['repo'])
            if status[0]:
                r_commits = status[1]
                for commit in r_commits:
                    commits[commit[0]] = commit[1]
            else:
                # if commits failed, return commit errors
                return status
        else:
            # if branch failed, return branch errors
            return status
        # if everything is good, return branches with commits
        return branches, commits
1325747
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'credential_type' in _dict:
            args['credential_type'] = _dict.get('credential_type')
        if 'client_id' in _dict:
            args['client_id'] = _dict.get('client_id')
        if 'enterprise_id' in _dict:
            args['enterprise_id'] = _dict.get('enterprise_id')
        if 'url' in _dict:
            args['url'] = _dict.get('url')
        if 'username' in _dict:
            args['username'] = _dict.get('username')
        if 'organization_url' in _dict:
            args['organization_url'] = _dict.get('organization_url')
        if 'site_collection.path' in _dict:
            args['site_collection_path'] = _dict.get('site_collection.path')
        if 'client_secret' in _dict:
            args['client_secret'] = _dict.get('client_secret')
        if 'public_key_id' in _dict:
            args['public_key_id'] = _dict.get('public_key_id')
        if 'private_key' in _dict:
            args['private_key'] = _dict.get('private_key')
        if 'passphrase' in _dict:
            args['passphrase'] = _dict.get('passphrase')
        if 'password' in _dict:
            args['password'] = _dict.get('password')
        if 'gateway_id' in _dict:
            args['gateway_id'] = _dict.get('gateway_id')
        if 'source_version' in _dict:
            args['source_version'] = _dict.get('source_version')
        if 'web_application_url' in _dict:
            args['web_application_url'] = _dict.get('web_application_url')
        if 'domain' in _dict:
            args['domain'] = _dict.get('domain')
        if 'endpoint' in _dict:
            args['endpoint'] = _dict.get('endpoint')
        if 'access_key_id' in _dict:
            args['access_key_id'] = _dict.get('access_key_id')
        if 'secret_access_key' in _dict:
            args['secret_access_key'] = _dict.get('secret_access_key')
        return cls(**args)
831231
public static Map<String, IAMSecurityCredential> getIAMSecurityCredentials() {
        Map<String, IAMSecurityCredential> credentialsInfoMap = new HashMap<String, IAMSecurityCredential>();

        List<String> credentials = getItems(EC2_METADATA_ROOT
                + "/iam/security-credentials");

        if (null != credentials) {
            for (String credential : credentials) {
                String json = getData(EC2_METADATA_ROOT
                        + "/iam/security-credentials/" + credential);
                try {
                    IAMSecurityCredential credentialInfo = mapper
                            .readValue(json, IAMSecurityCredential.class);
                    credentialsInfoMap.put(credential, credentialInfo);
                } catch (Exception e) {
                    log.warn("Unable to process the credential (" + credential
                            + "). " + e.getMessage(), e);
                }
            }
        }
        return credentialsInfoMap;
    }
1022543
def _load_yaml_credentials(filename=None, yaml_key=None):
    
    try:
        with open(os.path.expanduser(filename)) as f:
            search_creds = yaml.safe_load(f)[yaml_key]
    except FileNotFoundError:
        logger.error("cannot read file {}".format(filename))
        search_creds = {}
    except KeyError:
        logger.error("{} is missing the provided key: {}"
                     .format(filename, yaml_key))
        search_creds = {}

    return search_creds
924580
def get_keys(self):
        
        return github.PaginatedList.PaginatedList(
            github.RepositoryKey.RepositoryKey,
            self._requester,
            self.url + "/keys",
            None
        )
189822
def get_login_password(site_name="github.com",
                       netrc_file="~/.netrc",
                       git_credential_file="~/.git-credentials"):
    """"""
    try:
        n = netrc.netrc(os.path.expanduser(netrc_file))
    except OSError:
        pass
    else:
        if site_name in n.hosts:
            return n.hosts[site_name][0], n.hosts[site_name][2]

    try:
        with open(os.path.expanduser(git_credential_file)) as f:
            for line in f:
                parsed = parse.urlparse(line.strip())
                if parsed.hostname == site_name:
                    return (parse.unquote(parsed.username),
                            parse.unquote(parsed.password))
    except OSError:
        pass

    return None, None
842408
def credentials_lists(self):
        
        if self._credentials_lists is None:
            self._credentials_lists = CredentialListList(self._version, trunk_sid=self._solution['sid'], )
        return self._credentials_lists