Authentication
29 questions in 10 subtopics.
Form and basic login
A new Spring Boot application with spring-boot-starter-security and no configuration asks for a login on every page. What has Boot configured, and what is the difference between form login and HTTP Basic here?A REST client calling a Spring Boot API with HTTP Basic credentials receives a 302 redirect to /login instead of a 401. Why, and how do you fix it?UserDetailsService
Implement aUserDetailsService that loads users from a JPA repository, including locked accounts and roles. What does DaoAuthenticationProvider do with the result?Your company is moving user accounts from a local database to an external identity provider over six months. During the migration some users exist only in the old database. How would you design authentication in the Spring application?After several acquisitions your company has five customer account systems, each with its own login and user database. Customers want one account. How would you plan customer identity consolidation over several years?Password encoding
What doesDelegatingPasswordEncoder do, what does a stored value such as {bcrypt}$2a$10$... mean, and why should you not use NoOpPasswordEncoder or plain SHA-256 for passwords?You inherit a database of 3 million users whose passwords are stored as unsalted SHA-1 hashes. How do you move to a modern password hash without forcing everyone to reset?Security asks you to pick a password hashing policy for all applications in the company, including cost parameters. How would you decide and keep it current?Credential stuffing attacks on your consumer login are growing every year. What long-term programme would you set beyond strong password hashing?Session management
Explain session fixation and how Spring Security protects against it. What doSessionCreationPolicy values do?A Spring MVC application with server-side sessions must run on 10 instances with rolling deployments and limit each user to two concurrent sessions. How would you design session management?After a credential leak, the security team asks you to log out every user of a 40-service platform within five minutes. Some services use server sessions, others use JWTs valid for one hour. What can you do, and what would you change afterwards?Remember-me
Compare Spring Security's two remember-me implementations:TokenBasedRememberMeServices and PersistentTokenBasedRememberMeServices. Which is safer and why?Product wants users to stay signed in for 90 days on a banking-related web application. How would you meet the request without weakening security more than necessary?Multi-factor authentication
Design multi-factor authentication for a Spring Boot web application where all users need a password plus a one-time code, and administrators must use passkeys. What does Spring Security provide and what would you build?How would you roll out mandatory MFA across all internal and customer-facing applications in a large company?Your board asks whether the company should move customers to passwordless authentication with passkeys. How would you frame the decision?One-time token and passwordless login
Spring Security 6.4 added one-time token login. Explain how a magic-link login flow works and what you must configure.Users report that magic login links 'already used' errors appear on first click, mostly for corporate email addresses. What is going on and how do you fix it?Design passwordless login with passkeys (WebAuthn) for a consumer Spring Boot web application, including account recovery. What does Spring Security provide and what must you build?Pre-authentication with external SSO
What is pre-authentication in Spring Security, and how would you configure an application behind a reverse proxy that authenticates users and passes the username in a header?A security review finds that an internal Spring application trusts an X-User header from its SSO proxy, but the service is also exposed via a KubernetesNodePort. What is the risk and how do you fix it properly?Your company has 60 internal applications, some using a header-based SSO proxy, some SAML, some OIDC. How would you converge them onto one approach?LDAP authentication
Compare LDAP bind authentication and password comparison in Spring Security. Which would you use against Active Directory and why?Logins through LDAP take 8 to 15 seconds at peak, and some users with many nested groups get 'size limit exceeded'. What would you investigate and change?LDAP and Active Directory have been the identity backbone of your company for 25 years, but new SaaS tools and remote work demand cloud identity. As the senior technical leader, how would you plan the identity strategy?SAML 2.0 login
Explain the SAML 2.0 web browser SSO flow between a Spring Boot service provider and an identity provider. What does Spring Security'ssaml2Login need?SAML logins started failing for all users this morning with 'Invalid signature' after working for two years. Nothing was deployed. What is the most likely cause and how do you prevent a repeat?Your B2B SaaS product must support SAML SSO for 300 enterprise customers, each with their own IdP. Design the multi-tenant SAML setup.No question matches these choices.