Challenge - 5 Problems
Spring Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens after successful login in Spring Security?
In a typical Spring Security authentication flow, what is the immediate next step after a user successfully logs in?
Attempts:
2 left
💡 Hint
Think about what the user expects after logging in successfully.
✗ Incorrect
After successful login, Spring Security redirects the user to the page they originally requested or a default page if none was requested.
❓ lifecycle
intermediate2:00remaining
Order of filters in Spring Security authentication flow
Which filter in Spring Security is responsible for processing username and password authentication before the request reaches the controller?
Attempts:
2 left
💡 Hint
This filter handles form login credentials.
✗ Incorrect
UsernamePasswordAuthenticationFilter processes login form data and attempts authentication before the request proceeds.
🔧 Debug
advanced3:00remaining
Why does authentication fail with this configuration?
Given this Spring Security configuration snippet, why does authentication always fail?
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll();
}
}
Options:
Spring Boot
Same as promptAttempts:
2 left
💡 Hint
Check if the login page exists and is accessible.
✗ Incorrect
If the custom login page URL is not implemented or accessible, Spring Security cannot show the login form, causing authentication to fail.
📝 Syntax
advanced3:00remaining
Identify the error in this Spring Security password encoder bean
What is wrong with this Spring Boot password encoder bean definition?
@Bean
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
Options:
Spring Boot
Same as promptAttempts:
2 left
💡 Hint
Consider security best practices for password encoding.
✗ Incorrect
NoOpPasswordEncoder does not encode passwords and is insecure; it is deprecated and should only be used for testing.
🧠 Conceptual
expert3:00remaining
What is the role of SecurityContextHolder in Spring Security?
Choose the best description of SecurityContextHolder's role in Spring Security authentication flow.
Attempts:
2 left
💡 Hint
Think about where Spring Security keeps user login info during a request.
✗ Incorrect
SecurityContextHolder holds the Authentication object containing user details for the current thread, enabling access control decisions.