WSO2 身份服务器 5.10.0 - 无法实现基于 EmailOTP 的 MFA

问题描述

我已启用 EmailOTP 身份提供者,使用 WSO2 身份服务器作为电子邮件提供者。

在我的服务提供商中,我已启用 EmailOTP 作为身份验证的第二步。

Angular UI 应用程序是我的前端,当我在登录页面用户 OpenId Connect)上提供用户名/密码时,正在生成授权码,但没有调用第二步,即没有被 OTP 页面显示并且电子邮件未通过 OTP 发送给收件人。

我已按照此处提到的步骤操作,但将 Gmail 设为身份提供者。

OpenIdConnect 配置:

enter image description here

本地和出站身份验证配置:

enter image description here

EmailOTP IDP 配置(未使用 Gmail 或 SendGrid):

enter image description here

电子邮件适配器和身份验证器配置:

yield

基于脚本的身份验证配置:

[output_adapter.email]
from_address= "sender@domain.com"
username= "username@domain.com"
password= "password"
hostname= "smpt.hostname"
port= 25
enable_start_tls= false
enable_authentication= true

[authentication.authenticator.basic.parameters]
showAuthFailureReason = true

[authentication.authenticator.email_otp]
name ="EmailOTP"
enable=true

[authentication.authenticator.email_otp.parameters]
EMAILOTPAuthenticationEndpointURL = "https://10.201.8.13:5004/emailotpauthenticationendpoint/emailotp.jsp"
EmailOTPAuthenticationEndpointErrorPage = "https://10.201.8.13:5004/emailotpauthenticationendpoint/emailotpError.jsp"
EmailAddressRequestPage = "https://10.201.8.13:5004/emailotpauthenticationendpoint/emailAddress.jsp"
usecase = "local"
secondaryUserstore = "primary"
EMAILOTPMandatory = false
sendOTPToFederatedEmailAttribute = false
federatedEmailAttributeKey = "email"
EmailOTPEnableByUserClaim = true
CaptureAndUpdateEmailAddress = true
showEmailAddressInUI = true
useEventHandlerBasedEmailSender = true

OpenId 连接配置。

enter image description here

https://is.docs.wso2.com/en/5.10.0/learn/configuring-email-otp/#configuring-email-otp

端点详细信息:

var onLoginRequest = function(context) {
    executeStep(1);
    executeStep(2);
};

租户域错误

租户域用户被视为 carbon.super 域的用户

https://localhost:5004/oauth2/authorize?response_type=code&scope=openid&redirect_uri=http://localhost&client_id=<client_id>&code_challenge=<code_challenge>&code_challenge_method=S256&sectoken=<sec_token>

解决方法

在共享日志中,可以观察到以下行。

BasicAuthRequestPathAuthenticator can handle the request

这意味着 BasicAuthRequestPathAuthenticatorcanHandle() 方法已返回 true,因为 sectoken 查询参数被定义。然后,请求路径认证就发生了。

BasicAuth RequestPathAuthentication 不支持 MFA,就像密码授予一样。用户只需验证传递的凭据即可进行身份验证。

如果您的目标是在您的客户端应用程序 (Angular SPA) 上拥有登录页面,您可以将用户名和密码作为两个不同的参数传递(POST 或 GET;建议使用 POST,因为密码不会在 URL 中传递) 在 oauth2/authorize 请求中并进入默认的基本身份验证器而不是 RequestPathAuthenticator。然后 MFA 将按预期工作。