/// <summary> /// Check the OTP an does the real authentication /// </summary> /// <param name="proofData">the date from the HTML fild</param> /// <param name="authContext">The autch context which contains secrued parametes.</param> /// <returns>True if auth is done and user can be validated</returns> bool ValidateProofData(IProofData proofData, IAuthenticationContext authContext) { if (proofData == null || proofData.Properties == null || !proofData.Properties.ContainsKey("otpvalue")) { throw new ExternalAuthenticationException("Error - no answer found", authContext); } if (!ssl) { ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; } try { string otpvalue = (string)proofData.Properties["otpvalue"]; // fix for #14 and #15 string session_user = (string)authContext.Data["userid"]; string session_realm = (string)authContext.Data["realm"]; string transaction_id = (string)authContext.Data["transaction_id"]; // end fix #if DEBUG Debug.WriteLine(debugPrefix + "OTP Code: " + otpvalue + " User: "******" Server: " + session_realm + " Transaction_id: " + transaction_id); #endif return(otp_prov.getAuthOTP(session_user, otpvalue, session_realm, transaction_id)); } catch { throw new ExternalAuthenticationException("Error - can't validate the otp value", authContext); } }