Skip to content

Senior Quiz: Spring Security Internals

#

Question 1

Two SecurityFilterChain beans match /api/admin/reports. The first chain has a broader /api/** matcher and permits the request; the second requires ADMIN. What is the correct response?

#

Question 2

An authenticated USER requests an ADMIN endpoint. Which response and component responsibilities are correct?

#

Question 3

A team adds @ControllerAdvice for AccessDeniedException, but request authorization failures still return Spring's default response. Why?

#

Question 4

A browser SPA calls a state-changing API with an HttpOnly session cookie. The API returns JSON and has no HTML forms. Is disabling CSRF safe?

#

Question 5

Select the statements that correctly distinguish CORS from authorization.

#

Question 6

A browser application keeps the same session identifier before and after login. Why is this dangerous, and what fixes it?

#

Question 7

One application has a cookie-authenticated browser chain and a bearer-token API chain. How should CSRF and session policy be configured?

#

Question 8

A credentialed CORS response is configured with Access-Control-Allow-Origin: * and the browser refuses it. What is the correct fix?

#

Question 9

A service method has @PreAuthorize, but direct calls from another method in the same class are not intercepted. What is the likely cause?

#

Question 10

Which controls are required when migrating stored passwords from an older encoder?

#

Question 11

A custom JWT filter catches every parsing exception, logs the exception message, and continues anonymously. What can go wrong?

#

Question 12

An ADMIN role is stored as ADMIN, while a rule uses hasRole("ADMIN"). Which authority must Spring normally see?

#

Question 13

A login controller checks the submitted username to choose ROLE_ADMIN, generates a JWT, and never calls AuthenticationManager. Which changes are required?

#

Question 14

A database contains {noop}password for legacy users and {bcrypt}... for current users. What is the safe migration behavior?