Login 2FA using Vaadin


I’m currently trying to implement 2FA with TOTP in a Hilla application. For this i have to provide an additional text field at the login screen to input the current token. But only if 2FA is activated for this user.
Since i have to extend SpringSecurity AuthenticationProvider anyway to add the 2FA functionality i thought about throwing a specific specific exception in case the token is missing which would result in a http status code other than 401 for example. On client side authentication is triggered by Hillas login function from Authentication.js.
But looking through the source of login i can’t see a possibility to get the status code (or some other sort of flag) back to get the information that i have to show the additional textfield to the user and i see no possibility to provide the token-information to the login function if the user entered one.

Does someone have an idea how implement such a functionality? For the entered token i could control the loginProcessingUrl and append the token as a request parameter but for the other direction to get information that i should present the textfield to the user i see no way.