1 | <?php namespace nyx\auth\id\protocols\oauth1; |
||
25 | abstract class Signer implements interfaces\Signer |
||
26 | { |
||
27 | /** |
||
28 | * Generates the signature's base string for the given Request. |
||
29 | * |
||
30 | * @param Request $request The Request to generate the base string for. |
||
31 | * @param array $params Additional protocol parameters. |
||
32 | * @return string |
||
33 | * ---- |
||
34 | * @see https://tools.ietf.org/html/rfc5849#section-3.4.1 |
||
35 | * @see https://tools.ietf.org/html/rfc5849#section-3.4.1.3 |
||
36 | */ |
||
37 | protected function buildBaseString(Request $request, array $params) : string |
||
41 | |||
42 | /** |
||
43 | * Forms the Request's method according to spec. |
||
44 | * |
||
45 | * @param Request $request |
||
46 | * @return string |
||
47 | */ |
||
48 | protected function formMethod(Request $request) : string |
||
52 | |||
53 | /** |
||
54 | * Forms the Request's URI according to spec. |
||
55 | * |
||
56 | * @param Request $request |
||
57 | * @return string |
||
58 | */ |
||
59 | protected function formUri(Request $request) : string |
||
64 | |||
65 | /** |
||
66 | * Forms the Request's query string according to spec. |
||
67 | * |
||
68 | * @param Request $request |
||
69 | * @param array $params |
||
70 | * @return string |
||
71 | */ |
||
72 | protected function formQueryString(Request $request, array $params) : string |
||
88 | |||
89 | /** |
||
90 | * Encodes and sorts the protocol parameters according to spec. |
||
91 | * |
||
92 | * @param array $params |
||
93 | * @return array |
||
94 | */ |
||
95 | protected function normalizeParameters(array $params) : array |
||
108 | |||
109 | /** |
||
110 | * Creates a to-spec encoded query string out of each key/value pair in the initial array. |
||
111 | * Handles multi-dimensional arrays recursively. |
||
112 | * |
||
113 | * @param array $params Array of parameters to convert. |
||
114 | * @param array $queryParams The parameters to extend (used internally for nested data). |
||
115 | * @param string $prevKey Optional Array key to append |
||
116 | * @return string |
||
117 | */ |
||
118 | protected function buildQueryStringFromParams(array $params, array $queryParams = null, string $prevKey = '') : string |
||
143 | |||
144 | /** |
||
145 | * Creates a to-spec encoded signing key based on the Client's Credentials (and Token Credentials, if provided). |
||
146 | * |
||
147 | * @param credentials\Client $client |
||
148 | * @param auth\interfaces\Credentials $token |
||
149 | * @return mixed |
||
150 | */ |
||
151 | protected function createKey(credentials\Client $client, auth\interfaces\Credentials $token = null) |
||
157 | } |
||
158 |