I have an AuthenticationManager with multiple AuthenticationProviders. That works very well, the first AP that can auth² the Authentication authenticates the user and if none can, the user is refused.
Now I have an a bit more special case, and I need to find out which AuthenticationProvider authenticated a user that was authenticated successfully. I cannot seem to find a way in which this can be done in a stable and reliable fashion.
I can imagine some creative hacks (e.g. interleaving instances of an own AuthenticationProvider that always fails to authenticate, but which can help infer which was the last AuthenticationProvider that was seen), but that's really not the point. Is there an official way to do this?