public void ValidateSignInViewModel_InvalidCredentials_ThrowsRegistrationFailedException(string userName, string password) { var dataService = A.Fake <IDataService>(); var sut = new AuthValidationService(dataService); var model = new SignInViewModel { UserName = userName, Password = password, }; Assert.ThrowsAsync <SignInFailedException>(() => sut.ValidateSignInViewModel(model)); }
public void ValidateSignInViewModel_InvalidCredentials_ThrowsSignInFailedException(string userName, string password) { var authValidationService = new AuthValidationService(); var model = new SignInViewModel { Password = password, UserName = userName }; Action result = () => authValidationService.ValidateSignInViewModel(model); result.Should().Throw <SignInFailedException>(); }
public IActionResult GetToken(string userName, string password) { var userModel = new JwtUserViewModel() { Audience = SysContext.JwtAudience, Issuer = SysContext.JwtIssuer, SigningKey = SysContext.JwtSigningKey, UserName = userName, Password = password, }; var service = new AuthValidationService(); var result = service.GetAuthToken(userModel); return(Json(result)); }
public JwtTokenAlertMsg UriToken([FromUri] string userName, [FromUri] string password) { var userModel = new JwtUserViewModel() { Audience = SysContext.JwtAudience, Issuer = SysContext.JwtIssuer, SigningKey = SysContext.JwtSigningKey, UserName = userName, Password = password, }; var service = new AuthValidationService(); var result = service.GetAuthToken(userModel); return(result); }
public void ValidateSocialSignInViewModel_InvalidCredentials_ThrowsSocialSignInFailedException(string userName, string email, string firstName, string lastName) { var authValidationService = new AuthValidationService(); var model = new SocialSignInViewModel { UserName = userName, Email = email, FirstName = firstName, LastName = lastName }; Action result = () => authValidationService.ValidateSocialSignInViewModel(model); result.Should().Throw <SocialSignInFailedException>(); }
public JwtTokenAlertMsg PostToken(dynamic obj) { string userName = Convert.ToString(obj.userName); string password = obj.password ?? string.Empty; var userModel = new JwtUserViewModel() { Audience = SysContext.JwtAudience, Issuer = SysContext.JwtIssuer, SigningKey = SysContext.JwtSigningKey, UserName = userName, Password = password, }; var service = new AuthValidationService(); var result = service.GetAuthToken(userModel); return(result); }
public void ValidateRegisterViewModel_InvalidCredentials_ThrowsRegisterFailedException(string userName, string email, string password, string firstName, string lastName) { var authValidationService = new AuthValidationService(); var model = new RegisterViewModel { UserName = userName, Password = password, Email = email, FirstName = firstName, LastName = lastName }; Action result = () => authValidationService.ValidateRegisterViewModel(model); result.Should().Throw <RegistrationFailedException>(); }