Spring Security Flashcards

1
Q

What is Spring Security?

A

A framework that provides authentication, authorization, and protection against common attacks in Spring applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the @EnableWebSecurity annotation used for?

A

It enables Spring Security’s web security configuration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you secure endpoints in Spring Security?

A

By configuring access rules in the WebSecurityConfigurerAdapter or with annotations like @Secured and @PreAuthorize.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the role of UserDetailsService in Spring Security?

A

It loads user-specific data, typically used for authentication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you configure password encoding in Spring Security?

A

Using a PasswordEncoder bean such as BCryptPasswordEncoder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the default login URL provided by Spring Security?

A

/login.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you customize the login page in Spring Security?

A

By overriding the default login page URL and providing a custom login view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is CSRF protection in Spring Security?

A

Cross-Site Request Forgery protection, enabled by default in Spring Security to prevent unauthorized actions on behalf of authenticated users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you disable CSRF protection in Spring Security?

A

By calling csrf().disable() in the security configuration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is OAuth2 in Spring Security?

A

A framework for implementing single sign-on (SSO) and secure authorization using OAuth2 protocol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly