@param AWSStaticCredential $credential

@return string
500795
private function getSecret(AWSStaticCredential $credential)
    {
        if (!$secret = $credential->secret()) {
            return '';
        }

        return $secret = $this->encryption->decrypt($secret);
    }
123471
public function getClient($credential_id = null, $use_own_certificate = true)
    {
        $this->library->load('gapi');

        if (!class_exists('Google_Client')) {
            throw new LogicException('Class \Google_Client not found');
        }

        $client = new \Google_Client;

        if ($use_own_certificate) {
            $http = new Client(array('verify' => __DIR__ . '/../certificates/cacert.pem'));
            $client->setHttpClient($http);
        }

        if (isset($credential_id)) {

            $credential = $this->credential->get($credential_id);

            if (empty($credential['data']['file'])) {
                throw new OutOfBoundsException('Credential file path is empty');
            }

            $client->setAuthConfig(gplcart_file_absolute($credential['data']['file']));
        }


        return $client;
    }
807782
private function getConfigWithCredentials($region, $credential)
    {
        if (!in_array($region, self::$awsRegions, true)) {
            $this->logger->critical(self::ERR_INVALID_REGION, [
                'specified_region' => $region,
            ]);

            return null;
        }

        $credentials = null;

        if ($credential instanceof AWSStaticCredential) {
            $credentials = $this->credentialProvider->getStaticCredentials($credential);

        } elseif ($credential instanceof AWSRoleCredential) {
            $credentials = $this->credentialProvider->getRoleCredentials($credential, $region);
        }

        if (!$credentials) {
            $this->logger->critical(self::ERR_INVALID_CREDENTIAL);
            return null;
        }

        return [
            'region' => $region,
            'credentials' => $credentials,
        ];
    }
1269387
public function getServerCredential($credential)
    {
        $credentials = $this->getServerCredentials();

        return isset($credentials[$credential]) ? $credentials[$credential] : null;
    }
1354267
public function run( $credentials )
    {
        $status = self::STATUS_INVALID_USER;
        $count = eZPersistentObject::count( eZUser::definition(), array( 'contentobject_id' => (int)$credentials->id ) );
        if ( $count > 0 )
        {
            $status = self::STATUS_OK;
        }

        return $status;
    }
1065839
protected function _hmacSha1($request, $credentials)
    {
        $nonce = isset($credentials['nonce']) ? $credentials['nonce'] : uniqid();
        $timestamp = isset($credentials['timestamp']) ? $credentials['timestamp'] : time();
        $values = [
            'oauth_version' => '1.0',
            'oauth_nonce' => $nonce,
            'oauth_timestamp' => $timestamp,
            'oauth_signature_method' => 'HMAC-SHA1',
            'oauth_token' => $credentials['token'],
            'oauth_consumer_key' => $credentials['consumerKey'],
        ];
        $baseString = $this->baseString($request, $values);

        if (isset($credentials['realm'])) {
            $values['oauth_realm'] = $credentials['realm'];
        }
        $key = [$credentials['consumerSecret'], $credentials['tokenSecret']];
        $key = array_map([$this, '_encode'], $key);
        $key = implode('&', $key);

        $values['oauth_signature'] = base64_encode(
            hash_hmac('sha1', $baseString, $key, true)
        );

        return $this->_buildAuth($values);
    }
1171368
public function getCloudFormation($region, $credential)
    {
        if (!$config = $this->getConfigWithCredentials($region, $credential)) {
            return null;
        }

        return $this->aws->createCloudFormation($config);
    }
819859
public function authenticate(Credential $credential)
    {
        $username = $credential->username;
        $password = $credential->password;

        if (!$username || !$password) {
            $this->status = Authentication::EMPTY_CREDENTIAL;

            return false;
        }

        foreach ($this->users as $user) {
            if (!isset($user['username'])) {
                continue;
            }

            if ($user['username'] !== $username) {
                continue;
            }

            if (!isset($user['password'])) {
                $this->status = Authentication::INVALID_CREDENTIAL;

                return false;
            }

            $handler = $this->getVerifyHandler();

            if (call_user_func_array($handler, [$password, $user['password']])) {
                $this->status = Authentication::SUCCESS;

                return true;
            }

            $this->status = Authentication::INVALID_CREDENTIAL;

            return false;
        }

        $this->status = Authentication::USER_NOT_FOUND;

        return false;
    }
564809
public function findUser($identity, $credential)
    {
        $this->connection->connect();
        $stmt = $this->connection->prepare(
            "SELECT * FROM \"{$this->tableName}\" WHERE \"{$this->identityColumn}\" = :username " . $this->conditions
        );

        $stmt->execute([':username' => $identity]);
        $result = $stmt->fetch(PDO::FETCH_ASSOC);

        if ($result !== false || $stmt->rowCount() === 0) {
            if (!empty($result)) {
                if (isset($result[$this->credentialColumn])) {
                    if ($this->passwordCrypt->verify($credential, $result[$this->credentialColumn]) === true) {
                        return $result;
                    }

                    throw new CredentialInvalidException;
                }

                throw new Exception(sprintf('Column "%s" does not exists.', $this->credentialColumn));
            }

            throw new IdentityNotFoundException;
        }

        throw new Exception($stmt->errorInfo()[2], $stmt->errorInfo()[1]);
    }
923642
private function getAuthHeader()
    {
        $credential = $this->apiContext->getCredential();

        $header = '<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">';
        $header .= '<wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">';
        $header .= '<wsse:Username>' . $credential->getUsername() . '</wsse:Username>';
        $header .= '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $credential->getPassword() . '</wsse:Password>';
        $header .= '</wsse:UsernameToken>';
        $header .= '</wsse:Security>';

        $headerbody = new \SoapVar($header, XSD_ANYXML, null, null, null);
        return new \SOAPHeader(self::PAYU_NAMESPACE, 'Security', $headerbody, true);
    }
1248751
public function getRoleCredentials(AWSRoleCredential $credential, $region)
    {
        if (!$sts = $this->getStsWithInternalCredentials($region)) {
            return null;
        }

        $account = $credential->account();
        $role = $credential->role();
        $cacheKey = sprintf('%s_%s', $account, $role);

        $assumeRoleProvider = AWSCredentialProvider::assumeRole([
            'client' => $sts,
            'assume_role_params' => [
                'DurationSeconds' => $this->stsLifetime, # 900 - 3600
                'RoleArn' => sprintf('arn:aws:iam::%s:%s', $account, $role),
                'RoleSessionName' => 'hal-' . bin2hex(random_bytes(4)), # unique identifier for auditing
            ],
        ]);

        $provider = AWSCredentialProvider::memoize($assumeRoleProvider);
        if ($this->credentialCache) {
            $provider = AWSCredentialProvider::cache($provider, $this->credentialCache, $cacheKey);
        }

        return $provider;
    }
1110813
public function setCredential($credential)
    {
        $credential = (string) $credential;
        if ($credential === '') {
            throw new \InvalidArgumentException('$credential cannot be empty');
        }

        $this->credential = $credential;

        return $this;
    }
286346
def load_credential_file(self, path):
        """"""
        c_data = StringIO.StringIO()
        c_data.write("[Credentials]\n")
        for line in open(path, "r").readlines():
            c_data.write(line.replace("AWSAccessKeyId", "aws_access_key_id").replace("AWSSecretKey", "aws_secret_access_key"))
        c_data.seek(0)
        self.readfp(c_data)
565227
public function retrieveByCredentials(array $credentials)
    {
        if (empty($credentials)) {
            return;
        }

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.
        $query = $this->createModel()->newQuery();

        foreach ($credentials as $key => $value) {
            if (! Str::contains($key, 'password')) {
                $query->whereRaw("upper({$key}) = upper(?)", [$value]);
            }
        }

        return $query->first();
    }
429054
private static function _getCertKeyId(Certificate $cert): string
    {
        $exts = $cert->tbsCertificate()->extensions();
        if ($exts->hasSubjectKeyIdentifier()) {
            return $exts->subjectKeyIdentifier()->keyIdentifier();
        }
        return $cert->tbsCertificate()
            ->subjectPublicKeyInfo()
            ->keyIdentifier();
    }
677976
public function retrieveByCredentials(array $credentials)
    {
        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // generic "user" object that will be utilized by the Guard instances.
        $query = array();
        $coll = $this->conn->{$this->table};

        foreach ($credentials as $key => $value)
        {
            if ( ! str_contains($key, 'password'))
            {
                $query[$key] = $value;
            }
        }

        // Now we are ready to execute the query to see if we have an user matching
        // the given credentials. If not, we will just return nulls and indicate
        // that there are no matching users for these given credential arrays.
        $user = $coll->findOne($query);

        if ( ! is_null($user))
        {
            return new MongolUser((array) $user);
        }
    }
144243
protected function getListCredential()
    {
        $options = $this->query_filter;
        $options['limit'] = $this->data_limit;

        return $this->credential->getList($options);
    }