|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace SoapBox\SignedRequests\Configurations; |
| 4 | + |
| 5 | +class CustomConfiguration implements Configuration |
| 6 | +{ |
| 7 | + /** |
| 8 | + * The algorithm header to return. |
| 9 | + * |
| 10 | + * @var string |
| 11 | + */ |
| 12 | + protected $algorithmHeader; |
| 13 | + |
| 14 | + /** |
| 15 | + * The signature header to return. |
| 16 | + * |
| 17 | + * @var string |
| 18 | + */ |
| 19 | + protected $signatureHeader; |
| 20 | + |
| 21 | + /** |
| 22 | + * The signing algorithm to return. |
| 23 | + * |
| 24 | + * @var string |
| 25 | + */ |
| 26 | + protected $signingAlgorithm; |
| 27 | + |
| 28 | + /** |
| 29 | + * The signing key to return. |
| 30 | + * |
| 31 | + * @var string |
| 32 | + */ |
| 33 | + protected $signingKey; |
| 34 | + |
| 35 | + /** |
| 36 | + * Sets up our custom configuration with various properties. |
| 37 | + * |
| 38 | + * @param string $algorithmHeader |
| 39 | + * The algorithm header to use. |
| 40 | + * @param string $signatureHeader |
| 41 | + * The signature header to use. |
| 42 | + * @param string $signingAlgorithm |
| 43 | + * The signing algorithm to use. |
| 44 | + * @param string $signingKey |
| 45 | + * The signing key to use. |
| 46 | + */ |
| 47 | + public function __construct( |
| 48 | + string $algorithmHeader, |
| 49 | + string $signatureHeader, |
| 50 | + string $signingAlgorithm, |
| 51 | + string $signingKey |
| 52 | + ) { |
| 53 | + $this->algorithmHeader = $algorithmHeader; |
| 54 | + $this->signatureHeader = $signatureHeader; |
| 55 | + $this->signingAlgorithm = $signingAlgorithm; |
| 56 | + $this->signingKey = $signingKey; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Returns the name of the header that will contain the algorithm used to |
| 61 | + * sign the request. |
| 62 | + * |
| 63 | + * @return string |
| 64 | + */ |
| 65 | + public function getAlgorithmHeader(): string |
| 66 | + { |
| 67 | + return $this->algorithmHeader; |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Returns the name of the header that will contain the generated signature. |
| 72 | + * |
| 73 | + * @return string |
| 74 | + */ |
| 75 | + public function getSignatureHeader(): string |
| 76 | + { |
| 77 | + return $this->signatureHeader; |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * Returns the algorithm to use to generate the signature. |
| 82 | + * |
| 83 | + * @return string |
| 84 | + */ |
| 85 | + public function getSigningAlgorithm(): string |
| 86 | + { |
| 87 | + return $this->signingAlgorithm; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Returns the key to sign the request with. |
| 92 | + * |
| 93 | + * @return string |
| 94 | + */ |
| 95 | + public function getSigningKey(): string |
| 96 | + { |
| 97 | + return $this->signingKey; |
| 98 | + } |
| 99 | +} |
0 commit comments