We have detected an error in your notification set-up
(Event-ID dab39dc24f564ec7bd4628d1305fd03c).
Currently, we cannot inform you about inspection progress.
Please check that the user
557058:bca11929-8c2d-43f2-8a82-c5416880d395
still has access to your repository or
update the API account.
1 | <?php |
||
24 | class OAuthPlugin implements Plugin |
||
25 | { |
||
26 | use Plugin\VersionBridgePlugin; |
||
27 | |||
28 | const ENDPOINT_REQUEST_TOKEN = 'oauth/request_token'; |
||
29 | const ENDPOINT_ACCESS_TOKEN = 'oauth/access_token'; |
||
30 | const ENDPOINT_AUTHORIZE = 'oauth/authenticate'; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $config = array( |
||
36 | 'oauth_consumer_key' => 'anon', |
||
37 | 'oauth_consumer_secret' => 'anon', |
||
38 | 'oauth_token' => '', |
||
39 | 'oauth_token_secret' => '', |
||
40 | 'oauth_signature_method' => 'HMAC-SHA1', |
||
41 | 'oauth_callback' => '', |
||
42 | 'oauth_verifier' => '', |
||
43 | 'oauth_version' => '1.0', |
||
44 | ); |
||
45 | |||
46 | /** |
||
47 | * @var SignatureMethodInterface |
||
48 | */ |
||
49 | protected $signature; |
||
50 | |||
51 | /** |
||
52 | * @var TokenInterface |
||
53 | */ |
||
54 | protected $token; |
||
55 | |||
56 | /** |
||
57 | * @var ConsumerInterface |
||
58 | */ |
||
59 | protected $consumer; |
||
60 | |||
61 | public function __construct( |
||
72 | |||
73 | protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) |
||
91 | |||
92 | /** |
||
93 | * Include OAuth and request body parameters |
||
94 | * |
||
95 | * @access protected |
||
96 | * @param RequestInterface $request |
||
97 | * @return array |
||
98 | * |
||
99 | * @see http://oauth.net/core/1.0/#sig_norm_param |
||
100 | */ |
||
101 | protected function getParametersToSign(RequestInterface $request) |
||
111 | |||
112 | /** |
||
113 | * Include/exclude optional parameters |
||
114 | * |
||
115 | * The exclusion/inclusion is based on current request resource |
||
116 | * |
||
117 | * @access protected |
||
118 | * @param RequestInterface $request |
||
119 | * @return array |
||
120 | */ |
||
121 | protected function getOAuthParameters(RequestInterface $request) |
||
133 | |||
134 | /** |
||
135 | * White list based filter |
||
136 | * |
||
137 | * @access protected |
||
138 | * @param string[] $include |
||
139 | * @return array |
||
140 | */ |
||
141 | protected function filterOAuthParameters(array $include) |
||
153 | |||
154 | /** |
||
155 | * Transform request content to associative array |
||
156 | * |
||
157 | * @access protected |
||
158 | * @param RequestInterface $request |
||
159 | * @return array |
||
160 | */ |
||
161 | protected function getContentAsParameters(RequestInterface $request) |
||
167 | |||
168 | /** |
||
169 | * Check if specified endpoint is in current request |
||
170 | * |
||
171 | * @param string $endpoint |
||
172 | * @param RequestInterface $request |
||
173 | * @return bool |
||
174 | */ |
||
175 | protected function isEndpointRequested($endpoint, RequestInterface $request) |
||
179 | |||
180 | /** |
||
181 | * Bitbucket supports only HMAC-SHA1 and PlainText signatures. |
||
182 | * |
||
183 | * For better security, HMAC-SHA1 is the default one. |
||
184 | * |
||
185 | * @return \JacobKiers\OAuth\SignatureMethod\SignatureMethodInterface |
||
186 | */ |
||
187 | protected function getSigner() |
||
199 | |||
200 | /** |
||
201 | * @access public |
||
202 | * @param TokenInterface|null $token |
||
203 | * @return TokenInterface |
||
204 | */ |
||
205 | protected function initToken($token) |
||
214 | |||
215 | /** |
||
216 | * @access public |
||
217 | * @param ConsumerInterface|null $consumer |
||
218 | * @return ConsumerInterface |
||
219 | */ |
||
220 | protected function initConsumer($consumer) |
||
230 | } |
||
231 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.