QuizzesCSRF Protection & Session Management — Concept Check
intermediate
spring-boot

CSRF Protection & Session Management — Concept Check

Questions on CSRF Protection & Session Management. Spring Security enables CSRF protection by default for stateful apps; stateless REST APIs typically disable it and rely on JWT or API-key schemes instead.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on CSRF Protection & Session Management — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer is configuring a stateless REST API secured with JWT. What should they do regarding CSRF protection?

    • ADisable CSRF protection entirely
    • BUse CookieCsrfTokenRepository
    • CSet session policy to IF_REQUIRED
    • DEnable CSRF protection with a token
  2. 2.In a stateful web application using session cookies, how is CSRF protection typically implemented?

    • ABy using JWT tokens for CSRF protection
    • BBy disabling CSRF protection entirely
    • CBy storing a CSRF token in a session cookie
    • DBy requiring a CSRF token in a header or form field
  3. 3.A REST API is experiencing session fixation attacks. What is a suitable mitigation strategy?

    • ADisable session fixation protection
    • BUse CookieCsrfTokenRepository
    • CEnable session fixation protection with MIGRATE strategy
    • DEnable CSRF protection
  4. 4.A developer mistakenly enables CSRF protection on a stateless REST API using JWT. What is a likely consequence?

    • AIncreased security against CSRF attacks
    • BEnhanced token validation
    • CImproved session management
    • DUnnecessary complexity without added security
  5. 5.What is the role of HttpSessionEventPublisher in Spring Security?

    • ATo manage CSRF tokens
    • BTo handle JWT token validation
    • CTo notify session creation and destruction
    • DTo configure session timeout
  6. 6.A developer wants to ensure a single active session per user in a stateful app. What should they configure?

    • ASet maximumSessions to 1 and maxSessionsPreventsLogin to true
    • BDisable CSRF protection
    • CUse SessionCreationPolicy.STATELESS
    • DEnable JWT token validation
  7. 7.A single-page application (SPA) needs to send a CSRF token in a request header. Which configuration is correct?

    • AEnable session fixation protection
    • BUse CookieCsrfTokenRepository with HttpOnly=false
    • CUse JWT tokens for CSRF
    • DDisable CSRF protection
  8. 8.What happens if CSRF protection is enabled on a stateless REST API using JWT?

    • AIt provides additional security
    • BIt prevents session fixation attacks
    • CIt causes unnecessary configuration without benefit
    • DIt enables token rotation