public void StrongAuthenticateTest() { VetumaUriModel uris = new VetumaUriModel { CancelUri = new Uri("htt:\\tester.com"), ErrorUri = new Uri("htt:\\tester.com"), RedirectUri = new Uri("htt:\\tester.com") }; TransactionLanguage lan = TransactionLanguage.EN; string vetumaButtonInstructions = RandomData.GetString(); string vetumaButtonText = RandomData.GetString(); string transactionId = RandomData.GetString(); this.service.Authenticate(lan, uris, transactionId, vetumaButtonText, vetumaButtonInstructions); this.request.VetumaMethods.Count().Should().Be(2); this.request.VetumaMethods.Where(o => o == VetumaLoginMethod.Tupas).Count().Should().Be(1); this.request.VetumaMethods.Where(o => o == VetumaLoginMethod.HST).Count().Should().Be(1); // validate keys this.request.SharedSecret.Should().Be(VetumaKeys.VetumaAuthenticationSharedSecret.ToString()); this.request.SharedSecretId.Should().Be(VetumaHelpers.GetVetumaFormat(VetumaKeys.VetumaAuthenticationSharedSecretId)); this.request.ApplicationId.Should().Be(VetumaHelpers.GetVetumaFormat(VetumaKeys.VetumaApplicationIdentifier)); this.request.ConfigurationId.Should().Be(VetumaHelpers.GetVetumaFormat(VetumaKeys.VetumaAuthenticationConfigurationId)); request.ApplicationName.Should().Be(VetumaKeys.VetumaApplicationDisplayName.ToString()); }
/// <summary> /// Authenticate user via Authenticattion service. Redirects user to service wher euser use 3rth party tools for Authentication /// Method uses strings, keys from config file. /// </summary> /// <param name="language">TransactionLanguage 2-letter language code (EN,FI,SV)</param> /// <param name="uriModel">VetumaUriModel contains necessary uri links</param> /// <param name="transactionId">Unique TransactionId for authentication process</param> /// <param name="vetumaButtonText">Vetuma button text</param> /// <param name="vetumaButtonInstructions">Vetuma button instruction text</param> public void Authenticate(TransactionLanguage language, VetumaUriModel uriModel, string transactionId, string vetumaButtonText, string vetumaButtonInstructions) { // Allow authentication through banks and with an HST card Collection<VetumaLoginMethod> methods = new Collection<VetumaLoginMethod>(); methods.Add(VetumaLoginMethod.Tupas); methods.Add(VetumaLoginMethod.HST); // first two parameters are related to the VetumaRequest rendering a button to facilitate // // transferring to Vetuma when the user has javascript disabled. VetumaAuthenticationRequest request = new VetumaAuthenticationRequest(vetumaButtonText, vetumaButtonInstructions, language.ToString().ToLowerInvariant(), methods, uriModel.RedirectUri, uriModel.CancelUri, uriModel.ErrorUri, this.vetumaUtilities.GetConfigUriKey(VetumaKeys.VetumaAuthenticationUrl), this.vetumaUtilities.GetConfigKey(VetumaKeys.VetumaAuthenticationSharedSecretId), this.vetumaUtilities.GetConfigKey(VetumaKeys.VetumaAuthenticationSharedSecret), this.vetumaUtilities.GetConfigKey(VetumaKeys.VetumaApplicationIdentifier), this.vetumaUtilities.GetConfigKey(VetumaKeys.VetumaAuthenticationConfigurationId)); // Vetuma requires this additional parameter to retrieve personal ids from VTJ request.ExtraData = "VTJ1"; // store a unique identifier and attach it to the request request.TransactionId = transactionId; request.ApplicationName = this.vetumaUtilities.GetConfigKey(VetumaKeys.VetumaApplicationDisplayName); this.vetumeService.SubmitVetumaAuthenticationRequest(request); }
public void AuthentificationProcessRestulTest() { VetumaUriModel uris = new VetumaUriModel { CancelUri = new Uri("htt:\\tester.com"), ErrorUri = new Uri("htt:\\tester.com"), RedirectUri = new Uri("htt:\\tester.com") }; this.serviceMock.Setup(o => o.CreateVetumaAuthentificationResponse(It.IsAny<string>(), It.IsAny<string>())); this.service.ProcessResult(RandomData.GetString()); }