module Api module Internal # Base class for endpoints intended for the game-server only (never for # browsers). Authenticated via HMAC of the request body instead of a JWT: # see InternalSignatureService. class BaseController < ApplicationController skip_before_action :authenticate_request! before_action :authenticate_internal_request! private def authenticate_internal_request! unless InternalSignatureService.valid?(request) render json: { error: "Unauthorized" }, status: :unauthorized end end end end end