changed before filter to return json error when authentication is required