modify authorization middleware to support filtering for Whale

modify authorization middleware to support filtering for Whale