.NET

Authentication & Authorization

JWT tokens, cookie authentication, Identity, authorization policies, claims, role-based access

18 คำถามสัมภาษณ์·
Mid-Level
1

What is a JWT (JSON Web Token)?

คำตอบ

JWT is a self-contained token that encodes authentication information as digitally signed JSON. It consists of three parts separated by dots: header (algorithm), payload (data/claims), and signature (verification). Unlike server sessions, JWT is stateless and enables distributed authentication without server-side storage.

2

What is the fundamental difference between authentication and authorization?

คำตอบ

Authentication verifies user identity (who is he), while authorization determines permissions (what can he do). Authentication is always the first step, followed by authorization. For example, logging in with a password is authentication, then checking if the user can access an admin resource is authorization.

3

How does cookie authentication work in ASP.NET Core?

คำตอบ

The server generates an encrypted cookie after credential validation, automatically stored by the browser. This cookie contains user claims and is automatically sent with each request. The server decrypts the cookie to identify the user without database query. Suitable for traditional web applications with server-side navigation.

4

What is the typical JWT authentication workflow in an API?

5

What is a claim in the authentication context?

+15 คำถามสัมภาษณ์

เชี่ยวชาญ .NET สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี