需要在iOS,Android和Windows UWP的Xamarin Forms Mobile应用程序中进行多重身份验证。用户输入有效的用户名和密码后,应该有第二个因素AUTH - 电话呼叫/短信到注册设备。分步指南和示例应用程序将有助于加快此方案的实施。
答案 0 :(得分:0)
我想分享的其中一个实现:
在Xamarin.Forms应用程序中使用Dependency Service来定义身份验证界面,如:
public interface IAuthenticator
{
Task<AuthenticationResult> Authenticate(string authority, string resource, string clientId, string returnUri);
}
使用程序集依赖关系元数据属性为每个平台(here is all details)提供实现:
[assembly: Dependency(typeof(MFATestPCL.Droid.Helper.Authenticator))]
namespace MFATestPCL.Droid.Helper
通过共享代码拨打电话:
var auth = DependencyService.Get<IAuthenticator>();
authResult = await auth.Authenticate(authority, graphResourceUri, clientId, returnUri);
这是完整的GitHub sample Xamarin app repo with step-by-step guide of configuring Azure AD - 提供的iOS,Android和Windows 10 UWP实现。