Spring Security
Spring Security
Answer: B) HTTP
4. Which dependency is primarily added to a Spring Boot application to enable Spring Security?
o A) spring-boot-starter-web
o B) spring-boot-starter-data-jpa
o C) spring-boot-starter-security
o D) spring-boot-starter-thymeleaf
Answer: C) spring-boot-starter-security
5. In a Spring Boot application, how can you customize the default security configuration?
o A) By creating a class that extends WebSecurityConfigurerAdapter
o B) By creating a class that extends SpringBootApplication
o C) By modifying application.properties
o D) By creating a class that extends SpringApplication
6. What is the default behavior of Spring Security in a Spring Boot application without any custom configuration?
o A) No authentication required
o B) HTTP Basic Authentication
o C) Form-based login
o D) Token-based authentication
Answer: A) Authorization
10. Which interface must be implemented to retrieve user details from a database in Spring Security?
o A) UserDetailsManager
o B) UserDetails
o C) UserDetailsService
o D) UserManager
Answer: C) UserDetailsService
Answer: A) PasswordEncoder
12. Which annotation is used to specify security configurations at method level in Spring Security?
o A) @Secured
o B) @Security
o C) @Protected
o D) @RolesAllowed
Answer: A) @Secured
JWT Authorization
14. In JWT-based authentication, what component typically handles token creation and validation?
o A) TokenProvider
o B) TokenManager
o C) TokenEncoder
o D) TokenFactory
Answer: A) TokenProvider
16. Which HTTP header is commonly used to pass the JWT token in requests?
o A) Authorization
o B) Authenticate
o C) Token
o D) JWT
Answer: A) Authorization