public ActionResult ResendValidation(Resend model) { string connection = ConfigurationManager.AppSettings["InternalAPIURL"]; var appAccessToken = WebUtils.GetVaultSecret("AppConnectionKey"); ResendVerificationRequest resendRequest = new ResendVerificationRequest(connection, appAccessToken, model.EmailResend); ResendVerificationResponse resendResponse = resendRequest.Send(); if (resendResponse.StatusCode == System.Net.HttpStatusCode.OK) { TempData["Success"] = "Another verification email was sent."; return(RedirectToAction("Index", "Account")); } else { TempData["Errors"] = "There was an error processing your request"; return(RedirectToAction("Index", "Account")); } }
public void ResendValidation() { KeyVaultClient KeyVault; try { var azureServiceTokenProvider = new AzureServiceTokenProvider(); var _token = azureServiceTokenProvider.GetAccessTokenAsync("https://vault.azure.net").Result; KeyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback)); } catch (Exception e) { throw e; } var bundle = KeyVault.GetSecretAsync("https://pr-kv-uks-dev.vault.azure.net/secrets/AppConnectionKey").Result; string appAccessToken = bundle.Value; string email = "*****@*****.**"; ResendVerificationRequest request = new ResendVerificationRequest(connection, appAccessToken, email); ResendVerificationResponse response = request.Send(); Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK); }