Automattic\WooCommerce\Internal\PushNotifications\Controllers
PushNotificationRestController::authorize
Validates the JWT from the Authorization header, falling back to the token query parameter on hosts that strip the header before it reaches PHP (see {@see InternalNotificationDispatcher::TOKEN_QUERY_PARAM}).
Метод класса: PushNotificationRestController{}
Хуков нет.
Возвращает
true|WP_Error.
Использование
$PushNotificationRestController = new PushNotificationRestController(); $PushNotificationRestController->authorize( $request );
- $request(WP_REST_Request) (обязательный)
- The request object.
Список изменений
| С версии 10.7.0 | Введена. |
Код PushNotificationRestController::authorize() PushNotificationRestController::authorize WC 11.3.0
public function authorize( WP_REST_Request $request ) {
$reason = $this->find_authorization_failure( $request );
if ( null === $reason ) {
return true;
}
$this->log_authorization_failure( $request, $reason );
return new WP_Error(
'woocommerce_rest_unauthorized',
self::AUTH_FAILURE_MESSAGES[ $reason ],
array( 'status' => WP_Http::UNAUTHORIZED )
);
}