/// <summary> /// Start the FIDO2 Sign in type on Android. /// </summary> public async System.Threading.Tasks.Task SignInUserRequestAsync(string dataJson = "") { try { Fido2AuthenticationChallengeResponse dataObject = null; // Data to sign, given from the server if (dataJson != null && dataJson.Length > 0) // Authenticate using the token, but because the token don t received the origin of this aplication this cannot be used for now. { // transform the token JSON to a object // The reason to use class for de deserializa is because of bugs that appears when using Dictionary<string, object> in the number section dataObject = Newtonsoft.Json.JsonConvert.DeserializeObject <Fido2AuthenticationChallengeResponse>(dataJson); } else { // Preparing to request to the server the information about FIDO2 var request = new TwoFactorFido2ChallengeRequest { Email = this._authService.Email, MasterPasswordHash = this._authService.MasterPasswordHash }; // Send the request to the API Service dataObject = await this._apiService.GetTwoFactorFido2AuthenticationChallengeAsync(request); } // Save the event code that will be started this.fido2CodesType = Fido2CodesTypes.RequestSignInUser; // Start the FIDO2 API from the Android code, using the data build in Fido2 Builder var task = this.fido2ApiClient.GetSignPendingIntent(Fido2BuilderObject.ParsePublicKeyCredentialRequestOptions(dataObject)); task.AddOnSuccessListener((IOnSuccessListener)this.application) .AddOnFailureListener((IOnFailureListener)this.application) .AddOnCompleteListener((IOnCompleteListener)this.application); } catch (Exception e) { Log.Error(_tag_log, e.Message); } finally { Log.Info(_tag_log, "SignInUserRequest() -> finally()"); } }
public Task <Fido2AuthenticationChallengeResponse> GetTwoFactorFido2AuthenticationChallengeAsync(TwoFactorFido2ChallengeRequest request) { // send a request, asking for the FIDO2 data to use to sign return(SendAsync <TwoFactorFido2ChallengeRequest, Fido2AuthenticationChallengeResponse>( HttpMethod.Post, "/two-factor/get-fido2-auth-challenge", request, false, true)); }