public AuthRepository SignInFromAPI(AuthSignIn authSignIn) { UserRepository userRepo = this.userQueryRepository.FindByEmail(authSignIn.Email); if (userRepo.Email == null) { throw (new DataNotFoundException("Email")); } else if (!BC.Verify(authSignIn.Password, userRepo.Password)) { throw (new EmailAndPasswordException()); } DateTime expiredAt = DateTime.UtcNow.AddYears(1); return(new AuthRepository() { ExpiredAt = expiredAt, Token = AuthUtility.GenerateJwtToken(userRepo.Id) }); }