sforkowany z mirror/social
minimum elements for headers
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>feature/145/mastodon-api
rodzic
bbe59a942a
commit
250be300bd
|
@ -427,10 +427,15 @@ class SignatureService {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws SocialAppConfigException
|
* @throws SocialAppConfigException
|
||||||
|
* @throws SignatureException
|
||||||
*/
|
*/
|
||||||
private function generateEstimatedSignature(string $headers, IRequest $request): string {
|
private function generateEstimatedSignature(string $headers, IRequest $request): string {
|
||||||
$keys = explode(' ', $headers);
|
$keys = explode(' ', $headers);
|
||||||
|
|
||||||
|
if (!empty(array_diff(['(request-target)', 'date', 'digest', 'host'], $keys))) {
|
||||||
|
throw new SignatureException('missing elements in \'headers\'');
|
||||||
|
}
|
||||||
|
|
||||||
$target = '';
|
$target = '';
|
||||||
try {
|
try {
|
||||||
$target = strtolower($request->getMethod()) . " " . $request->getRequestUri();
|
$target = strtolower($request->getMethod()) . " " . $request->getRequestUri();
|
||||||
|
|
Ładowanie…
Reference in New Issue