1 | <?php |
||
25 | class AsymmetricJwtAuthModule extends AbstractModule |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $algo; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | private $ttl; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $privateKey; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | private $publicKey; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $passPhrase; |
||
51 | |||
52 | /** |
||
53 | * @param string $algo Hashing algorithm |
||
54 | * @param int $ttl Time to live for JWT |
||
55 | * @param string $privateKey Private key |
||
56 | * @param string $publicKey Public key |
||
57 | * @param string $passPhrase Pass phrase |
||
58 | */ |
||
59 | 5 | public function __construct(string $algo, int $ttl, string $privateKey, string $publicKey, string $passPhrase) |
|
60 | { |
||
61 | 5 | if ($algo == '' |
|
62 | 4 | || $ttl < 0 |
|
63 | 4 | || $privateKey == '' |
|
64 | 4 | || $privateKey == '' |
|
65 | 5 | || $passPhrase == '') { |
|
66 | 1 | throw new NoConfigException; |
|
67 | } |
||
68 | |||
69 | 4 | $this->algo = $algo; |
|
70 | 4 | $this->ttl = $ttl; |
|
71 | 4 | $this->privateKey = $privateKey; |
|
72 | 4 | $this->publicKey = $publicKey; |
|
73 | 4 | $this->passPhrase = $passPhrase; |
|
74 | 4 | } |
|
75 | |||
76 | 4 | protected function configure() |
|
90 | } |
||
91 |