You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I fail to pass through the second factor and third factor authentication in the mfa module because in the both case the MfaAuthentication authentication is null
Below is more detail explanation:
in /mfa/src/main/java/example/MfaController.java file
@PostMapping("/second-factor")
publicvoidprocessSecondFactor(@RequestParam("code") Stringcode, MfaAuthenticationauthentication,
HttpServletRequestrequest, HttpServletResponseresponse) throwsException {
// authentication object is null but if I write it like below, I get the authentication object// MfaAuthentication authentication = (MfaAuthentication) SecurityContextHolder.getContext().getAuthentication();MfaAuthenticationHandlerhandler = newMfaAuthenticationHandler("/third-factor");
...
}
@PostMapping("/third-factor")
publicvoidprocessThirdFactor(@RequestParam("answer") Stringanswer, MfaAuthenticationauthentication,
HttpServletRequestrequest, HttpServletResponseresponse) throwsException {
// authentication object is null but if I write it like below, I get the authentication object// MfaAuthentication authentication = (MfaAuthentication) SecurityContextHolder.getContext().getAuthentication();StringencodedAnswer = getAnswer(authentication);
...
}
Can anyone explain why this is happening? I tried to debug but fail to get any explanation.
The text was updated successfully, but these errors were encountered:
imtiazShakil
changed the title
authentication object is null in second-factor and third-factor controller in mfa module
authentication object is null for second-factor and third-factor post methods in MfaController in mfa module
Jan 13, 2025
I fail to pass through the second factor and third factor authentication in the mfa module because in the both case the
MfaAuthentication authentication
isnull
Below is more detail explanation:
in
/mfa/src/main/java/example/MfaController.java
fileCan anyone explain why this is happening? I tried to debug but fail to get any explanation.
The text was updated successfully, but these errors were encountered: