intermediateCustom AuthenticationProvider & Exception Handling
What are the two methods every AuthenticationProvider must implement, and what does each do?
authenticate(Authentication) performs the actual verification and returns a fully-populated, authenticated Authentication object on success (or throws AuthenticationException on failure). supports(Class<?>) tells ProviderManager whether this provider is capable of handling a given Authentication implementation type, so ProviderManager can pick the right provider without hardcoded type-checking logic.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response