Spring Security Objective Questions and Answers

This Spring Security quiz contains carefully curated objective questions with correct answers and clear explanations. It is designed for developers, security learners, and interview preparation, covering authentication, authorization, encryption, JWT, OAuth2, and advanced Spring Security concepts.

Practice Spring Security MCQs with Detailed Explanations

Answer at least 12 questions to submit.

1.
Medium
Which of the following is true about the default password storage in Spring Security 5?
2.
Easy
What is the default HTTP method for CSRF protection in Spring Security?
3.
Medium
Which annotation enables method-level security in Spring Security?
4.
Medium
In Spring Security, what does the 'ROLE_' prefix signify?
5.
Medium
Which of the following is NOT a standard authentication mechanism supported by Spring Security?
6.
Medium
What is the primary purpose of the AuthenticationManager in Spring Security?
7.
Medium
Which interface in Spring Security provides access to the current user’s authentication information?
8.
Medium
Which of the following statements about JWT in Spring Security is correct?
9.
Medium
What does the @PreAuthorize annotation allow you to do?
10.
Medium
In Spring Security, what is the default behavior when a user is unauthenticated and tries to access a protected resource?
11.
Medium
Which PasswordEncoder implementation should be used for maximum compatibility with older Spring Security versions?
12.
Medium
Which Spring Security filter handles authentication of login credentials?
13.
Medium
How can you disable CSRF protection for a specific endpoint in Spring Security?
14.
Medium
Which method in UserDetailsService loads a user by username?
15.
High
Which of the following is true about OAuth2 Resource Server in Spring Security?
Answered: 0 / 15