1 | <?php namespace nyx\auth\id\protocols\oauth1; |
||
20 | abstract class Provider extends id\Provider implements interfaces\Provider |
||
21 | { |
||
22 | /** |
||
23 | * @var interfaces\Signer The Signer used for generating OAuth 1.0a compliant signatures of Requests |
||
24 | * sent to this Identity Provider service. |
||
25 | */ |
||
26 | protected $signer; |
||
27 | |||
28 | /** |
||
29 | * {@inheritDoc} |
||
30 | * |
||
31 | * @param interfaces\Signer $signer The Signer to use for generating OAuth 1.0a compliant signatures |
||
32 | * of Requests sent to this Identity Provider service. |
||
33 | */ |
||
34 | public function __construct(id\credentials\Client $consumer, interfaces\Signer $signer = null) |
||
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | public function getTemporaryCredentialsUrl() : string |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | public function authorize(callable $redirect, array $parameters = []) |
||
67 | |||
68 | /** |
||
69 | * {@inheritDoc} |
||
70 | */ |
||
71 | public function handshake() : Promise |
||
79 | |||
80 | /** |
||
81 | * {@inheritDoc} |
||
82 | */ |
||
83 | public function exchange(auth\Credentials $temporary, string $verifier) : Promise |
||
91 | |||
92 | /** |
||
93 | * {@inheritDoc} |
||
94 | */ |
||
95 | public function identify(auth\Credentials $credentials) : Promise |
||
101 | |||
102 | /** |
||
103 | * {@inheritDoc} |
||
104 | */ |
||
105 | protected function getDefaultRequestOptions(auth\interfaces\Token $token = null) : array |
||
115 | |||
116 | /** |
||
117 | * {@inheritDoc} |
||
118 | * |
||
119 | * Overridden as we need to instantiate a custom middleware stack that includes our authorization |
||
120 | * middleware for Guzzle. |
||
121 | */ |
||
122 | protected function getHttpClient() : \GuzzleHttp\ClientInterface |
||
134 | |||
135 | /** |
||
136 | * Returns the Signer used for generating OAuth 1.0a compliant signatures of Requests sent to this |
||
137 | * Identity Provider service. Lazily instantiates a default HMAC-SHA1 Signer if no Signer is set yet. |
||
138 | * |
||
139 | * @return interfaces\Signer |
||
140 | */ |
||
141 | protected function getSigner() : interfaces\Signer |
||
145 | |||
146 | /** |
||
147 | * Performs a POST request to the specified URL assuming the Response will contain form-encoded |
||
148 | * OAuth 1.0a credentials, either temporary or proper, which will then be used to create a auth\Credentials |
||
149 | * instance out of. |
||
150 | * |
||
151 | * @param string $url The URL to query. |
||
152 | * @param array $options Additional request options (will be merged with the defaults). |
||
153 | * @param auth\Credentials $temporary A set of temporary credentials. Must be set when requesting |
||
154 | * proper credentials as it affects how the middleware signs the request. |
||
155 | * Must *not* be set when requesting those temporary credentials as this |
||
156 | * in turn affects how the response is verified. |
||
157 | * @return Promise A Promise for a set of Credentials (an auth\Credentials instance). |
||
158 | */ |
||
159 | protected function requestCredentials(string $url, array $options, auth\Credentials $temporary = null) : Promise |
||
186 | } |
||
187 |