1 | <?php |
||
21 | final class ClientSecretPost implements AuthenticationMethod |
||
22 | { |
||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $secretLifetime; |
||
27 | |||
28 | /** |
||
29 | * ClientSecretPost constructor. |
||
30 | * |
||
31 | * @param int $secretLifetime |
||
32 | */ |
||
33 | public function __construct(int $secretLifetime = 0) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function getSchemesParameters(): array |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function findClientIdAndCredentials(ServerRequestInterface $request, &$clientCredentials = null): ? ClientId |
||
54 | { |
||
55 | $parameters = $request->getParsedBody() ?? []; |
||
56 | if (array_key_exists('client_id', $parameters) && array_key_exists('client_secret', $parameters)) { |
||
57 | $clientCredentials = $parameters['client_secret']; |
||
58 | |||
59 | return ClientId::create($parameters['client_id']); |
||
60 | } |
||
61 | |||
62 | return null; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function checkClientConfiguration(DataBag $command_parameters, DataBag $validated_parameters): DataBag |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function isClientAuthenticated(Client $client, $clientCredentials, ServerRequestInterface $request): bool |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function getSupportedMethods(): array |
||
88 | { |
||
89 | return ['client_secret_post']; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | private function createClientSecret(): string |
||
99 | } |
||
100 |