- Added some more features to attributes and various Curl wrappers
This commit is contained in:
1 parent
b1adf5a086
commit
fe56a1727b
9 files changed
+142
-15
No files matched your search
@@ -18,6 +18,10 @@ class CurlAuthorization
|
||||
public function fromAuthenticationEnum(AuthenticationEnum $auth,) : static
|
||||
{
|
||||
switch($auth) {
|
||||
case AuthenticationEnum::Custom:
|
||||
$this->customHeader($this->configuration['header'], $this->configuration['secret']);
|
||||
break;
|
||||
|
||||
case AuthenticationEnum::Bearer:
|
||||
$this->bearer($this->configuration['token']);
|
||||
break;
|
||||
@@ -96,6 +100,11 @@ class CurlAuthorization
|
||||
$this->userpass(CURLAUTH_NEGOTIATE, $username, $password);
|
||||
}
|
||||
|
||||
public function customHeader(string $header, #[\SensitiveParameter] string $token) : void
|
||||
{
|
||||
$this->headers[$header] = $token;
|
||||
}
|
||||
|
||||
public function oauth2(Oauth2GrantTypeEnum $grant, string $oauthTokenUrl, string $redirectUri, string $clientId, string $clientSecret, string $scope) : void
|
||||
{
|
||||
$unid = sprintf("oauth_token_%s", md5(serialize($this->configuration)));
|
||||
|
||||
Reference in new issue
Block a user