How can CSRF protection be customized or disabled in Spring Security?
- Configure a CsrfFilter bean to customize settings.
- Modify the csrf() method in the HttpSecurity configuration.
- Use the @EnableCsrf annotation to disable CSRF protection.
- Set csrf.enabled property to false in application.properties.
CSRF protection customization or disabling is done by modifying the csrf() method in the HttpSecurity configuration, typically by calling disable() or csrfTokenRepository(). While Option 1 is partially correct, it doesn't encompass all customization options. Options 3 and 4 are incorrect.
Loading...
Related Quiz
- Which of the following annotations is used to mark a class as a source of bean definitions?
- Suppose you are working on a project where you need to create several beans with business logic, database interaction, and APIs. How would you use different annotations to organize and define these beans properly?
- Which Spring Cloud component is primarily used for service discovery in a microservices architecture?
- How can you configure multiple DataSources in a Spring Boot application?
- In a Spring Boot application, the _____ annotation is used to demarcate transaction boundaries.