Quick revision
The short answer
I would lead it as a risk-driven programme: make the case that custom authentication code is a recurring source of vulnerabilities and audit findings, move applications to a central identity provider using standard protocols (OIDC for people, OAuth2 for APIs) with framework support in each application, and migrate in order of risk, internet-facing and high-privilege systems first. The cost is justified by fewer incidents, faster audits, single sign-on and less duplicated work, and the programme succeeds only if it funds real migration help for teams, because mandates without support stall.
What to remember
In this answer, we saw that custom authentication code is a recurring source of vulnerabilities, audit findings and duplicated work. The programme moves applications to a central identity provider with OIDC and OAuth2 handled by framework support, migrates in waves ordered by risk, starting with internet-facing and high-privilege systems, and funds starters, guides and a migration squad so teams can actually move. The cost is justified with numbers: lower incident risk, faster audits, single sign-on and fewer reset tickets, and less duplicated work.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would lead it as a risk-driven programme: make the case that custom authentication code is a recurring source of vulnerabilities and audit findings, move applications to a central identity provider using standard protocols (OIDC for people, OAuth2 for APIs) with framework support in each application, and migrate in order of risk, internet-facing and high-privilege systems first. The cost is justified by fewer incidents, faster audits, single sign-on and less duplicated work, and the programme succeeds only if it funds real migration help for teams, because mandates without support stall.
Why this question is asked
After fifteen years, most companies have many generations of login code: a homegrown session filter from 2011, a custom token format from 2015, a copy of it with a bug fix in one team only, a vendor product with its own user table. Each one works well enough that nobody wants to touch it. Interviewers ask this at the leadership level because the technical destination is obvious, and the hard part is getting there across dozens of teams with a credible business case. In this answer, we will look at why custom authentication is a liability, choose the target, decide the order, plan how teams actually migrate, and build the cost justification with numbers.
1Why Custom Authentication Is a Liability
Authentication code looks simple and is full of details that are easy to get wrong: password storage, session fixation, token expiry, replay, timing attacks, lockout, reset flows, multi-factor authentication. Every custom implementation has to get all of them right and keep them right as attacks evolve. In practice, penetration tests and audits find the same classes of issues again and again in homegrown login code: weak hashing, tokens that never expire, missing lockout, reset links that can be reused.
There is also an organisational cost. Each application has its own user store, so a person who leaves the company must be removed from twenty places, and an access review means twenty exports. That is where audit findings like 'leaver still active after 90 days' come from. The point for leadership is that this is not a technology preference; it is an ongoing source of risk and work that grows with every application.
2Choosing the Target
The destination is a central identity provider (an IdP such as Keycloak, Okta or Microsoft Entra ID) that owns users, passwords, multi-factor authentication and sessions, and applications that speak standard protocols to it: OpenID Connect (OIDC) for people logging into web applications, OAuth2 access tokens for APIs and service calls, and SAML only where a vendor product supports nothing else.
Inside each application, the framework does the protocol work. A Spring Boot application uses oauth2Login() and oauth2ResourceServer() instead of custom filters, so the remaining application code is about authorization, what a user may do, not about checking credentials. For applications that cannot be changed soon, an authenticating reverse proxy in front of them is an acceptable stepping stone, documented as an exception with a date.
- Central identity providerUsers, passwords, MFA, sessions, federation
- Standard protocolsOIDC for people, OAuth2 for APIs, SAML only for legacy vendors
- Shared starters and librariesFramework configuration per stack, maintained centrally
- ApplicationsAuthorization only; no credential checking code
- Stopgap for unchangeable appsAuthenticating proxy, exception with an end date
5 layers, from the top down. Step through them one at a time.
3Deciding the Order by Risk
We cannot migrate 120 applications at once, so we order them. The first step is an inventory: every application, how it authenticates, whether it is internet-facing, how privileged its users are, what data it holds, and any open findings. That inventory alone is often eye-opening; it is common to find a dozen distinct login implementations and several applications nobody owns.
Then we score and sequence. Internet-facing applications with customer or financial data and admin consoles with high privileges go first, because a flaw there is most likely to be found and most damaging. Internal, low-privilege tools go last, and some may simply be retired. A typical plan gives the first wave of ten high-risk applications one quarter, then moves at a steady pace the platform team can support.
| Wave | Applications | Why this order |
|---|---|---|
| 1 | Customer portals, payment admin, 10 apps | Internet-facing, highest privilege, open findings |
| 2 | Partner APIs and internal admin tools, 25 apps | External callers or broad access |
| 3 | Internal business apps, 60 apps | Lower exposure; mostly starter upgrades |
| 4 | Rarely used tools, 25 apps | Proxy, migrate, or retire |
4Making Migration Easy for Teams
A programme that says 'all teams must move to the IdP by December' and nothing else will stall. Teams have roadmaps, the migration competes with features, and the first team to try discovers all the hard problems alone. So the programme funds real help: a platform team that maintains starters for each stack, a written migration guide with the user-store migration steps (including how to move password hashes or force a reset), a small migration squad that pairs with the first teams in each wave, and test environments where the IdP is ready to use.
The mandate still exists, but it comes after the help. Once the starter and guide are proven on the first wave, dates are set per wave, tracked in the same forum as security findings, and exceptions need a named owner and a date.
5Justifying the Cost
Leadership will ask what this costs and what it saves, so we answer with numbers, even rough ones. Suppose the programme costs a platform team of five engineers for two years plus about two engineer-weeks for each of the 120 applications. At a loaded cost of around 250,000 dollars per engineer-year, that is about 2.5 million for the platform team and 1.2 million for the migrations, so roughly 4 million dollars in total.
The biggest return is the one that is hardest to put on a spreadsheet: reduced incident risk. Authentication flaws are among the most damaging vulnerabilities, and a single serious breach of a customer portal, with its investigation, notification and lost trust, costs far more than the whole programme. The audit return is easier to see, because access reviews and leaver checks then run once against the IdP instead of separately for every application, which saves weeks of effort each year and closes findings that otherwise repeat. Single sign-on and multi-factor authentication everywhere bring a very concrete saving as well, since fewer passwords mean fewer reset tickets; at 1,500 resets a month and around 20 dollars each, that alone is over 350,000 dollars a year. And because dozens of teams stop maintaining their own login code, reset flows and user tables, that engineering time goes back to features.
The honest framing is that the programme converts an open-ended, growing risk into a fixed, planned cost, and that each wave delivers measurable results, such as findings closed and applications on the IdP, so leadership can see progress quarter by quarter.
6Follow-up questions
How do you migrate users without forcing everyone to reset their password?
Many identity providers can import existing password hashes if the algorithm is supported, or verify the old hash on first login and then rehash it in their own format. Where the old storage is too weak to trust, a forced reset is the safer choice, communicated in advance and combined with enrolling multi-factor authentication.
A team says their custom login has never had an incident. How do you respond?
Absence of known incidents is not evidence of safety, especially without regular testing. I would look at their pen-test findings and audit evidence together with them, show the cost of maintaining the code, and offer migration help in their wave, rather than arguing in the abstract.
How do you measure success?
I would measure what leadership was promised. The share of applications and logins on the IdP shows progress, and the number of distinct custom authentication implementations still running shows how much risk is left. Open authentication-related findings and the time it takes to remove a leaver's access everywhere show the audit benefit, and password reset volume shows the single sign-on benefit. If one of these stops moving for a quarter, that is where the programme needs attention.
7Conclusion
In this answer, we saw that custom authentication code is a recurring source of vulnerabilities, audit findings and duplicated work. The programme moves applications to a central identity provider with OIDC and OAuth2 handled by framework support, migrates in waves ordered by risk, starting with internet-facing and high-privilege systems, and funds starters, guides and a migration squad so teams can actually move. The cost is justified with numbers: lower incident risk, faster audits, single sign-on and fewer reset tickets, and less duplicated work.
Open with
I'd frame it as risk reduction, not a technology refresh. Fifteen years of custom authentication means many implementations of things that are easy to get wrong, like password storage, token expiry, reset flows and lockout, and audits and pen tests keep finding the same issues.
Then, if they want more
It also means a user store per application, so leaver removal and access reviews are slow, which is where many audit findings come from.
The target is a central identity provider handling users, MFA and sessions, with applications using OIDC for people and OAuth2 for APIs through framework support, so in Spring that's oauth2Login and the resource server, not custom filters. Unchangeable apps get an authenticating proxy as a dated exception.
I'd start with an inventory of every application, how it authenticates, its exposure and privilege, and then migrate in waves by risk: internet-facing and high-privilege systems first, internal low-risk tools last or retired.
The key lesson from programmes like this is that mandates without help stall, so I'd fund a platform team that maintains starters per stack, a migration guide that covers moving password hashes, and a small squad that pairs with the first teams; dates come after the path is proven.
For the cost case I'd use numbers: around four million over two years, against breach risk on customer portals, weeks of audit effort saved each year, password reset tickets that alone can cost hundreds of thousands a year, and dozens of teams no longer maintaining login code. And I'd report progress quarterly: apps migrated, implementations retired, findings closed.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Security reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Over 15 years your company has built custom authentication code in many applications....": https://scrivio-interview-library.netlify.app/spring-boot/security-architecture/5eb84cb94d/