Connect middleware to ensure request is authorized to view a resource