Set Authentication credentials
@param $apiKey
@param $apiSecret
@return $this
507562
public function authenticate($apiKey, $apiSecret)
    {
        $this->auth[0] = $apiKey;
        $this->auth[1] = $apiSecret;

        return $this;
    }
364820
protected function setCloudApiClient($key, $secret) {
    try {
      $connector = new Connector(array(
        'key' => $key,
        'secret' => $secret,
      ));
      $cloud_api = Client::factory($connector);
      // We must call some method on the client to test authentication.
      $cloud_api->applications();
      $this->cloudApiClient = $cloud_api;
      return $cloud_api;
    }
    catch (\Exception $e) {
      // @todo this is being thrown after first auth. still works? check out.
      $this->logger->error('Failed to authenticate with Acquia Cloud API.');
      $this->logger->error('Exception was thrown: ' . $e->getMessage());
      return NULL;
    }
  }
1149189
static public function apiSig($apiSecret, $vars)
    {
        ksort($vars);
        $signature = '';
        foreach ($vars as $name => $value) {
            $signature .= $name . $value;
        }
        $signature .= $apiSecret;
        $hashedSignature = md5($signature);

        return $hashedSignature;
    }
253179
public function key($key)
    {
        $this->key = self::hkdf($key, 'KeyForEncryption');
        $this->authentication = self::hkdf($key, 'KeyForAuthentication');

        return $this;
    }
103844
def set_credentials(self, username, password=None, region=None,
            tenant_id=None, authenticate=False):
        
        self.api_key = None
        super(RaxIdentity, self).set_credentials(username, password=password,
                region=region, tenant_id=tenant_id, authenticate=authenticate)
312415
public function setBearerKey($bearerKey)
    {
        $this->bearerKey = $bearerKey;

        $this->httpClient->setDefaultOption(
            'headers/Authorization',
            $this->getAuthorizationHeader()
        );
    }
827616
public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey)
    {
        try {
            $event = new ApiAuthenticateEvent();

            if (null !== $token->getCredentials()) {
                $event->setUserName($token->getUsername());
                $event->setPassword($token->getCredentials());
                $this->dispatcher->dispatch(ApiAuthenticationEvents::AUTHENTICATE, $event);
            } elseif ($token->getUser() instanceof User) {
                //if we have no password then only way to authenticate is by api key
                $event->setApiKey($token->getUser()->getApiKey());
                $this->dispatcher->dispatch(ApiAuthenticationEvents::API_KEY_AUTHENTICATE, $event);
            }

            $user = $userProvider->loadUserByUsername($token->getUsername());
        } catch (UsernameNotFoundException $e) {
            throw new AuthenticationException($e->getMessage());
        }

        return new UsernamePasswordToken(
            $user,
            $user->getPassword(),
            $providerKey,
            $user->getRoles()
        );
    }
1326125
public function setApiAuthUrlUserKey($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->api_auth_url_user_key !== $v) {
            $this->api_auth_url_user_key = $v;
            $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_URL_USER_KEY;
        }


        return $this;
    }
138076
public static function constructFrom($values, $apiKey=null)
    {
        $class = get_class($this);
        return self::scopedConstructFrom($class, $values, $apiKey);
    }
181056
public function setCredentials(array $credentials) : AuthenticatorInterface
    {
        if (array_key_exists('source', $credentials) && preg_match('/^api*/', $credentials['source'])) {
            $this->api = true;
            $this->source = $credentials['source'];
        }

        return $this;
    }
550783
public function setAuthentication(array $credentials): AbstractClientBuilder
    {
        if (array_key_exists('session_id', $credentials)) {
            $this->authentication = new HeaderAuthenticate($credentials['session_id']);
        } elseif (array_key_exists('username', $credentials) && array_key_exists('password', $credentials)) {
            $this->authentication = new HeaderLogin($credentials['username'], $credentials['password']);
        } else {
            throw new \InvalidArgumentException('No credentials given.');
        }

        return $this;
    }
976691
def setUserKeyCredentials(self, username, public_key=None, private_key=None):
        """"""

        self.setCredentialValues(username=username, public_key=public_key, private_key=private_key)
842782
public static function setSSLAuth($sslCert = null, $sslKey = null, $sslCACert = null)
	{
		self::$sslCert = $sslCert;
		self::$sslKey = $sslKey;
		self::$sslCACert = $sslCACert;
	}
597546
public function storeApiKey(string $apiKey) {
		$hash = password_hash($apiKey, PASSWORD_BCRYPT);

		$stmt = $this->db->prepare(
			"INSERT INTO sessions (user_id, login_hash, api_hash) " .
			"VALUES (?, NULL, ?) " .
			"ON DUPLICATE KEY UPDATE api_hash=?;"
		);
		$stmt->bind_param("iss",
			$this->user->id, $hash, $hash);
		$stmt->execute();
		$this->db->commit();
	}
1113739
public function validate($apiUsername, $apiPassword)
    {
        if ($apiUsername && $apiPassword) {
            $this->setApiUsername($apiUsername)
                ->setApiPassword($apiPassword);
            $accountInfo = $this->getAccountInfo();

            if (isset($accountInfo->message)) {
                $message = 'VALIDATION ERROR :  ' . $accountInfo->message;
                $this->helper->debug('validate', [$message]);

                return false;
            }

            return $accountInfo;
        }

        return false;
    }
531508
public function setAuthToken($tenantKey, $authToken, $authTokenExpiration)
    {
        if ($this->tenantTokens[$tenantKey] == null) {
            $this->tenantTokens[$tenantKey] = array();
        }
        $this->tenantTokens[$tenantKey]['authToken'] = $authToken;
        $this->tenantTokens[$tenantKey]['authTokenExpiration'] = $authTokenExpiration;
    }
1232472
public void setApiKey(String apiKey) {
        for (Authentication auth : authentications.values()) {
            if (auth instanceof ApiKeyAuth) {
                ((ApiKeyAuth) auth).setApiKey(apiKey);
                return;
            }
        }
        throw new RuntimeException("No API key authentication configured!");
    }