-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
149 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCz\OpenIDConnect\Discovery; | ||
|
||
use DigitalCz\OpenIDConnect\Discovery\Traits\ParametersTrait; | ||
use InvalidArgumentException; | ||
|
||
final class JWK | ||
{ | ||
use ParametersTrait; | ||
|
||
/** @param array<string, mixed> $values */ | ||
public function __construct(array $values) | ||
{ | ||
$values['kty'] ?? throw new InvalidArgumentException('Key "kty" is mandatory'); | ||
$this->parameters = $values; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DigitalCz\OpenIDConnect\Discovery; | ||
|
||
use InvalidArgumentException; | ||
use JsonSerializable; | ||
|
||
class JWKs implements JsonSerializable | ||
{ | ||
/** @var JWK[] */ | ||
private array $keys; | ||
|
||
/** @param JWK[] $keys */ | ||
public function __construct(array $keys) | ||
{ | ||
$this->keys = $keys; | ||
} | ||
|
||
/** @param array<string, mixed> $values */ | ||
public static function fromArray(array $values): self | ||
{ | ||
$keys = $values['keys'] ?? throw new InvalidArgumentException('Key "keys" is missing'); | ||
|
||
return new self(array_map(static fn (array $keyData) => new JWK($keyData), $keys)); | ||
} | ||
|
||
/** @return JWK[] */ | ||
public function keys(): array | ||
{ | ||
return $this->keys; | ||
} | ||
|
||
/** @return array{keys: array<int, array<string, string>>} */ | ||
public function toArray(): array | ||
{ | ||
return ['keys' => array_map(static fn (JWK $key) => $key->all(), $this->keys())]; | ||
} | ||
|
||
/** @return array{keys: array<int, array<string, string>>} */ | ||
public function jsonSerialize(): array | ||
{ | ||
return $this->toArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"keys": [ | ||
{ | ||
"kty": "RSA", | ||
"e": "AQAB", | ||
"use": "sig", | ||
"n": "y930dtGTeMG52IPsKmMuEpPHLaxuYQlduZd6BqFVjc2-UFZR8fNqtnYzAjbXWJD_Tqxgdlj_MW4vogvX4sHwVpZONvdyeGoIyDQtis6iuGQhQamV85F_JbrEUnEw3QCO87Liz5UXG6BK2HRyPhDfMex1_tO0ROmySLFdCTS17D0wah71Ibpi0gI8LUi6kzVRjYDIC1oE-iK3Y9s88Bi4ZGYJxXAbnNwbwVkGOKCXja9k0jjBGRxZD-4KDuf493lFOOEGSLDA2Qp9rDqrURP12XYgvf_zJx_kSDipnr0gL6Vz2n3H4-XN4tA45zuzRkHoE7-XexPq-tv7kQ8pSjY2uQ", | ||
"kid": "bbd2ac7c4c5eb8adc8eeffbc8f5a2dd6cf7545e4", | ||
"alg": "RS256" | ||
}, | ||
{ | ||
"kty": "RSA", | ||
"e": "AQAB", | ||
"use": "sig", | ||
"alg": "RS256", | ||
"kid": "85828c59284a69b54b27483e487c3bd46cd2a2b3", | ||
"n": "zMHxWuxztMKXdBhv3rImlUvW_yp6nO03cVXPyA0Vyq0-M7LfOJJIF-OdNoRGdsFPHVKCFoo6qGhR8rBCmMxA4fM-Ubk5qKuUqCN9eP3yZJq8Cw9tUrt_qh7uW-qfMr0upcyeSHhC_zW1lTGs5sowDorKN_jQ1Sfh9hfBxfc8T7dQAAgEqqMcE3u-2J701jyhJz0pvurCfziiB3buY6SGREhBQwNwpnQjt_lE2U4km8FS0woPzt0ccE3zsGL2qM-LWZbOm9aXquSnqNJLt3tGVvShnev-GiJ1XfQ3EWm0f4w0TX9fTOkxstl0vo_vW_FjGQ0D1pXSjqb7n-hAdXwc9w" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters