import { Action } from "routing-controllers"; import { config } from '../config'; /** * Handles authentication via jwt's (Bearer authorization header) for all api endpoints using the @Authorized decorator. * @param action Routing-Controllers action object that provides request and response objects among other stuff. * @param permissions The permissions that the endpoint using @Authorized requires. */ const AuthChecker = async (action: Action) => { const provided_token = action.request.query.key; return provided_token == config.api_key; } export default AuthChecker