การตั้งค่าปลั๊กอิน
การตั้งค่าปลั๊กอินการปิดใช้งาน Introspection

การปิดใช้งาน Introspection

ฟิลด์ __schema ของ Introspection ถูกเปิดเผยใน Access Control Lists:

__schema field in the Access Control List

ซึ่งช่วยให้เราสามารถปิดใช้งาน Introspection สำหรับ Single Endpoint หรือ Custom Endpoints โดยเลือกใช้กฎที่มีอยู่แล้ว เช่น:

  • ปิดใช้งานเสมอ
  • ปิดใช้งานสำหรับผู้ใช้ที่ยังไม่ได้เข้าสู่ระบบ
  • ปิดใช้งานสำหรับผู้ใช้ที่ไม่มี Role หรือ Capability ที่กำหนด

Disabling the __schema field in the Access Control List

ตัวอย่างเช่น เมื่อเปิด GraphiQL client บน Custom Endpoint หลังจากปิดการเข้าถึง __schema แล้ว จะเกิดข้อผิดพลาด:

Uncaught (in promise) Error: Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: { __schema: null }

GraphiQL error from disabled introspection