Scrivio Interview library

Authentication

29 questions in 10 subtopics.

Form and basic login

ConceptFoundations6 min read
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?
DebuggingFoundations6 min read
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

CodingFoundations7 min read
Implement a UserDetailsService that loads users from a JPA repository, including locked accounts and roles. What does DaoAuthenticationProvider do with the result?
ScenarioIntermediate7 min read
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?
LeadershipPrincipal6 min read
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

ConceptFoundations6 min read
What does DelegatingPasswordEncoder 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?
ScenarioIntermediate7 min read
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?
LeadershipAdvanced6 min read
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?
LeadershipPrincipal6 min read
Credential stuffing attacks on your consumer login are growing every year. What long-term programme would you set beyond strong password hashing?

Session management

ConceptFoundations6 min read
Explain session fixation and how Spring Security protects against it. What do SessionCreationPolicy values do?
DesignIntermediate6 min read
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?
ScenarioAdvanced7 min read
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

ConceptFoundations6 min read
Compare Spring Security's two remember-me implementations: TokenBasedRememberMeServices and PersistentTokenBasedRememberMeServices. Which is safer and why?
ScenarioIntermediate6 min read
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

DesignIntermediate7 min read
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?
LeadershipAdvanced6 min read
How would you roll out mandatory MFA across all internal and customer-facing applications in a large company?
LeadershipPrincipal6 min read
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

ConceptFoundations6 min read
Spring Security 6.4 added one-time token login. Explain how a magic-link login flow works and what you must configure.
DebuggingIntermediate6 min read
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?
DesignIntermediate6 min read
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

ConceptFoundations6 min read
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?
ScenarioIntermediate6 min read
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 Kubernetes NodePort. What is the risk and how do you fix it properly?
DesignAdvanced6 min read
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

ConceptFoundations6 min read
Compare LDAP bind authentication and password comparison in Spring Security. Which would you use against Active Directory and why?
DebuggingIntermediate7 min read
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?
LeadershipPrincipal6 min read
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

ConceptFoundations7 min read
Explain the SAML 2.0 web browser SSO flow between a Spring Boot service provider and an identity provider. What does Spring Security's saml2Login need?
DebuggingIntermediate7 min read
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?
ScenarioAdvanced7 min read
Your B2B SaaS product must support SAML SSO for 300 enterprise customers, each with their own IdP. Design the multi-tenant SAML setup.