check allowPing only when is_auth_optional is False
@@ -54,10 +54,11 @@ async def ping(request):
try:
auth_token = request.token
except AttributeError:
+ if request.is_auth_optional is False:
cfg_mgr = ConfigurationManager(connect.get_storage_async())
category_item = await cfg_mgr.get_category_item('rest_api', 'allowPing')
allow_ping = True if category_item['value'].lower() == 'true' else False
- if request.is_auth_optional is False and allow_ping is False:
+ if allow_ping is False:
_logger.warning("Permission denied for Ping when Auth is mandatory.")
raise web.HTTPForbidden
