Spring Security Basics — Concept Check
Questions on Spring Security Basics. Spring Security adds authentication and authorisation to your application; it plugs in as a chain of servlet filters that intercept every HTTP request.
Questions in this quiz
7 questions on Spring Security Basics — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer configures a Spring Boot application with a SecurityFilterChain but notices that all requests are receiving a 401 response. What could be the cause?
- ASecurityFilterChain is missing
- BUserDetailsService is not implemented
- CCSRF protection is enabled
- DAuthenticationEntryPoint is misconfigured
2.In a Spring Security setup, a user is unable to access the /api/admin endpoint despite having the ADMIN role. What might be the issue?
- ASession is not created
- BJWT filter is not applied
- CRole is not correctly assigned
- DCSRF token is missing
3.A developer wants to ensure that only the owner of an order or an admin can delete it. Which annotation should they use?
- A@PermitAll
- B@PostAuthorize
- C@PreAuthorize
- D@Secured
4.What happens if a request does not match any SecurityFilterChain in a Spring Security setup?
- AThe request is denied
- BA default filter chain processes it
- CThe request is allowed
- DAn exception is thrown
5.A Spring Boot application uses form login by default. How can a developer switch to JWT-based authentication?
- AAdd a JWT filter before UsernamePasswordAuthenticationFilter
- BDisable form login in application.properties
- CRemove SecurityFilterChain bean
- DEnable JWT in SecurityConfig
6.Which component in Spring Security is responsible for loading user details by username?
- AAuthenticationEntryPoint
- BUserDetailsService
- CAccessDeniedHandler
- DSecurityFilterChain
7.What is the role of the DelegatingFilterProxy in Spring Security?
- AProcesses JWT tokens
- BManages session creation
- CDelegates to FilterChainProxy
- DHandles CSRF protection