Spring Security Flashcards
What is Spring Security?
A framework that provides authentication, authorization, and protection against common attacks in Spring applications.
What is the @EnableWebSecurity annotation used for?
It enables Spring Security’s web security configuration.
How do you secure endpoints in Spring Security?
By configuring access rules in the WebSecurityConfigurerAdapter or with annotations like @Secured and @PreAuthorize.
What is the role of UserDetailsService in Spring Security?
It loads user-specific data, typically used for authentication.
How do you configure password encoding in Spring Security?
Using a PasswordEncoder bean such as BCryptPasswordEncoder.
What is the default login URL provided by Spring Security?
/login.
How can you customize the login page in Spring Security?
By overriding the default login page URL and providing a custom login view.
What is CSRF protection in Spring Security?
Cross-Site Request Forgery protection, enabled by default in Spring Security to prevent unauthorized actions on behalf of authenticated users.
How do you disable CSRF protection in Spring Security?
By calling csrf().disable() in the security configuration.
What is OAuth2 in Spring Security?
A framework for implementing single sign-on (SSO) and secure authorization using OAuth2 protocol.