Skip to content

Commit

Permalink
mfa ui fix: now it is capable to pass the mfa-method field fixed to e…
Browse files Browse the repository at this point in the history
…mail (that is the only mfa supported right now)
  • Loading branch information
mrFlick72 committed Jul 27, 2024
1 parent 735fba0 commit 31e14e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/frontend/app/mfa/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const MfaChallengePage: React.FC<MfaChallengePageProps> = ({ rawI18nMessages,raw

{<form action="mfa-challenge" method="post">
<Box>
<input name="mfa-method" type="hidden" value="EMAIL_MFA_METHOD"/>
<input name={csrfName} type="hidden" value={csrfToken}/>

<FormInputTextField id="mfa-code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.springframework.ui.Model
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestParam
import java.util.*

@Controller
class MfaController(
Expand Down Expand Up @@ -49,13 +50,14 @@ class MfaController(
fun processSecondFactor(
@RequestParam("mfa-code") mfaCode: String,
@RequestParam("mfa-method") mfaMethod: MfaMethod,
@RequestParam("mfa-channel") mfaChannel: String,
@RequestParam("mfa-channel", required = false) mfaChannel: Optional<String>,
authentication: Authentication,
request: HttpServletRequest,
response: HttpServletResponse
) {
try {
otpMfaVerifier.verifyMfaChallengeFor(authentication.name, mfaMethod, mfaChannel, MfaChallenge(mfaCode))
val mfaChannel2 = mfaChannel.orElseGet { authentication.name }
otpMfaVerifier.verifyMfaChallengeFor(authentication.name, mfaMethod, mfaChannel2, MfaChallenge(mfaCode))
publisher.publishEvent(MfaSuccessEvent(authentication))
nextHopeLoginWorkflowSuccessHandler.onAuthenticationSuccess(request, response, authentication)
} catch (e: Exception) {
Expand Down

0 comments on commit 31e14e7

Please sign in to comment.