There is a need to have Multi-Factor Authentication in Xamarin Forms Mobile app across iOS, Android and Windows UWP. After user enters valid user name and password there should be second factor AUTH - phone call/SMS to registered device. Step-by-step guide and sample app would be useful to speed-up implementation of this scenario.
0
votes
This is not the place for a step-by-step documentation. SO is the place for specific questions for a problem
ā Nico Haase
I just wanted to share what I have found as solution - please take a look to my solution below and give me feedback on does it fit the purpose of solving specific problem/question or not. Thank you in advance
ā Romuald Zdebskiy
1 Answers
0
votes
One of the implementations Iād like to share:
- Azure Active Directory as directory and multi-factor authentication service. You can use Azure AD accounts for access or integrate Azure AD with corporate Active Directory domain with Active Directory Federation Services. Here you get account management and multi-factor infrastructure (phone registration, call/SMS service and policies)
- Active Directory Authentication Library (ADAL) to use inside Xamarin Forms app.
Using Dependency Service in Xamarin.Forms app to define authentication interface like:
public interface IAuthenticator { Task<AuthenticationResult> Authenticate(string authority, string resource, string clientId, string returnUri); }
Provide implementation for every platform (here is all details) with assembly Dependency metadata attribute:
[assembly: Dependency(typeof(MFATestPCL.Droid.Helper.Authenticator))] namespace MFATestPCL.Droid.Helper
Make a call from the shared code:
var auth = DependencyService.Get<IAuthenticator>(); authResult = await auth.Authenticate(authority, graphResourceUri, clientId, returnUri);
Here is full GitHub sample Xamarin app repo with step-by-step guide of configuring Azure AD ā iOS, Android and Windows 10 UWP implementations provided.