0
0
Spring Bootframework~5 mins

JWT vs session-based decision in Spring Boot - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is a JSON Web Token (JWT)?
A JWT is a compact, URL-safe token that securely transmits information between parties as a JSON object. It is often used for stateless authentication.
Click to reveal answer
beginner
How does session-based authentication work in Spring Boot?
Session-based authentication stores user data on the server side and tracks the user with a session ID stored in a cookie on the client side.
Click to reveal answer
intermediate
What is a key advantage of JWT over session-based authentication?
JWT is stateless, meaning the server does not need to store session data, which helps with scalability and reduces server memory use.
Click to reveal answer
intermediate
What is a main security concern with JWT?
If a JWT is stolen, it can be used until it expires because it is self-contained and does not require server-side invalidation.
Click to reveal answer
intermediate
When might session-based authentication be preferred over JWT?
When you want easier control over user logout and session invalidation, or when your app is mostly server-rendered and stateful.
Click to reveal answer
Which authentication method stores user data on the server?
ASession-based authentication
BJWT authentication
COAuth 2.0
DAPI key authentication
What is a benefit of JWT being stateless?
AEasier to invalidate tokens immediately
BNo need to store session data on the server
CRequires less client storage
DAutomatically encrypts user data
What is a common risk when using JWT?
ATokens can be used until expiration if stolen
BServer memory overload
CRequires cookies to work
DDoes not support mobile apps
Which method allows easy server-side logout?
ABasic authentication
BJWT authentication
CSession-based authentication
DToken-based authentication
Which is true about JWT tokens?
AThey always expire after 1 hour
BThey require server-side storage
CThey cannot be used in REST APIs
DThey are self-contained and include user info
Explain the main differences between JWT and session-based authentication in Spring Boot.
Think about where user data is stored and how logout works.
You got /4 concepts.
    Describe scenarios where you would choose JWT over session-based authentication and vice versa.
    Consider app type and control over user sessions.
    You got /3 concepts.