API接口-优化/创建保存jwt
This commit is contained in:
@@ -14,6 +14,7 @@ use app\common\model\MallPlayxDailyPush;
|
||||
use app\common\model\MallPlayxSession;
|
||||
use app\common\model\MallPlayxOrder;
|
||||
use app\common\model\MallPlayxUserAsset;
|
||||
use app\common\library\PlayxInboundJwt;
|
||||
use support\think\Db;
|
||||
use Webman\Http\Request;
|
||||
use support\Response;
|
||||
@@ -156,6 +157,14 @@ class Playx extends Api
|
||||
return $response;
|
||||
}
|
||||
|
||||
$partnerJwtSecret = strval(config('playx.partner_jwt_secret', ''));
|
||||
if ($partnerJwtSecret !== '') {
|
||||
$authHeader = strval($request->header('authorization', ''));
|
||||
if (!PlayxInboundJwt::verifyBearer($authHeader, $partnerJwtSecret)) {
|
||||
return $this->error(__('Invalid or missing JWT'), null, 0, ['statusCode' => 401]);
|
||||
}
|
||||
}
|
||||
|
||||
$body = $request->post();
|
||||
if (empty($body)) {
|
||||
$raw = $request->rawBody();
|
||||
|
||||
Reference in New Issue
Block a user