def auth_func(self, request, *args, **kwargs): token = "invalid" if "token" in request.args: token = request.args["token"] elif request.requestHeaders.hasHeader("X-Request-Token"): token = request.requestHeaders.getRawHeaders("X-Request-Token",[None])[0] if token == HoneyProxy.getApiAuthToken(): return f(self, request, *args, **kwargs) else: return ForbiddenResource(message="Invalid response Token").render(request)
def auth_func(self, request, *args, **kwargs): token = "invalid" if "token" in request.args: token = request.args["token"] elif request.requestHeaders.hasHeader("X-Request-Token"): token = request.requestHeaders.getRawHeaders( "X-Request-Token", [None])[0] if token == HoneyProxy.getApiAuthToken(): return f(self, request, *args, **kwargs) else: return ForbiddenResource( message="Invalid response Token").render(request)
def render_GET(self, request): return json.dumps({"token": HoneyProxy.getApiAuthToken()})