.NET

Authentication & Authorization

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

18 domande da colloquioยท
Mid-Level
1

What is a JWT (JSON Web Token)?

Risposta

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?

Risposta

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?

Risposta

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 domande da colloquio

Padroneggia .NET per il tuo prossimo colloquio

Accedi a tutte le domande, flashcards, test tecnici, esercizi di code review e simulatori di colloquio.

Inizia gratis