diff --git a/src/Authentication/AuthenticationMethod.php b/src/Authentication/AuthenticationMethod.php index 18137c6..6367ba2 100644 --- a/src/Authentication/AuthenticationMethod.php +++ b/src/Authentication/AuthenticationMethod.php @@ -6,5 +6,13 @@ abstract class AuthenticationMethod implements Arrayable { - // + public function toArray(): array + { + return [ + 'key' => 'Authorization', + 'value' => sprintf('%s {{token}}', $this->prefix()), + ]; + } + + abstract public function prefix(): string; } diff --git a/src/Authentication/Basic.php b/src/Authentication/Basic.php index 7fb5837..c35e380 100644 --- a/src/Authentication/Basic.php +++ b/src/Authentication/Basic.php @@ -4,8 +4,8 @@ class Basic extends AuthenticationMethod { - public function toArray(): array + public function prefix(): string { - return []; + return 'Basic'; } } diff --git a/src/Authentication/Bearer.php b/src/Authentication/Bearer.php index e63e63d..814ce58 100644 --- a/src/Authentication/Bearer.php +++ b/src/Authentication/Bearer.php @@ -4,8 +4,8 @@ class Bearer extends AuthenticationMethod { - public function toArray(): array + public function prefix(): string { - return []; + return 'Bearer'; } }