
Security & Authentication
Firewalls, providers, encoders, voters, authenticators, JWT, OAuth2, access control
1บทบาทหลักของ firewall ใน Security component ของ Symfony คืออะไร?
บทบาทหลักของ firewall ใน Security component ของ Symfony คืออะไร?
คำตอบ
firewall ใน Symfony กำหนดโซนความปลอดภัยสำหรับส่วนหนึ่งของแอปพลิเคชัน โดยจะกำหนดว่าผู้ใช้จะถูกตรวจสอบสิทธิ์อย่างไร (form, token, API key) และ URL ใดบ้างที่ถูกป้องกัน แต่ละ firewall สามารถมีการตั้งค่าการตรวจสอบสิทธิ์และ user provider ของตัวเองได้
2User Provider ใน Symfony Security คืออะไร?
User Provider ใน Symfony Security คืออะไร?
คำตอบ
User Provider มีหน้าที่โหลดข้อมูลผู้ใช้จากแหล่งข้อมูล (ฐานข้อมูล, LDAP, API ภายนอก) โดยจะ implement UserProviderInterface และมีเมธอดสำหรับโหลดผู้ใช้ตาม identifier หรือรีเฟรชข้อมูลผู้ใช้จาก session
3คลาส User ต้อง implement interface ใดเพื่อใช้กับ Symfony Security?
คลาส User ต้อง implement interface ใดเพื่อใช้กับ Symfony Security?
คำตอบ
คลาส User ต้อง implement UserInterface ซึ่งกำหนดเมธอดที่จำเป็น ได้แก่ getUserIdentifier() สำหรับตัวระบุที่ไม่ซ้ำ, getRoles() สำหรับบทบาท และ eraseCredentials() เพื่อลบข้อมูลที่ละเอียดอ่อน นอกจากนี้ยังต้องใช้ PasswordAuthenticatedUserInterface สำหรับการตรวจสอบสิทธิ์ด้วยรหัสผ่าน
จะกำหนดการควบคุมการเข้าถึงตามบทบาทใน security.yaml อย่างไร?
ความแตกต่างระหว่าง authentication และ authorization ใน Symfony Security คืออะไร?
+23 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Symfony อื่นๆ
PHP สมัยใหม่ (8.1+)
พื้นฐาน Symfony
Routing & Controllers
Twig & Templates
พื้นฐาน Doctrine ORM
ฟอร์ม Symfony
การตรวจสอบความถูกต้องของข้อมูล
Dependency Injection & Services
Doctrine ขั้นสูง
API Platform
Serializer Component
Events & Event Subscribers
Console & Commands
Messenger Component
HTTP Client
Cache & ประสิทธิภาพ
Workflow Component
Testing Symfony
Mailer Component
การแปลและ i18n
EasyAdmin Bundle
สถาปัตยกรรม Symfony
ประสิทธิภาพและการเพิ่มประสิทธิภาพ
ความปลอดภัยขั้นสูง
Custom Bundles
Microservices ด้วย Symfony
Real-time & WebSockets
Deployment & DevOps
เชี่ยวชาญ Symfony สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี