Skip to content

Commit

Permalink
Fix authentication exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Apr 24, 2024
1 parent 757a388 commit e69631f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/FunderMaps.Core/Services/SignInService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private async Task<ClaimsIdentity> CreateClaimsIdentityAsync(User user, string a
{
logger.LogWarning("User '{user}' locked out.", user);

throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}

await userRepository.ResetAccessFailed(user.Id);
Expand Down Expand Up @@ -137,7 +137,7 @@ public virtual async Task<ClaimsPrincipal> UserIdSignInAsync(Guid id, string aut
{
if (await userRepository.GetByIdAsync(id) is not User user)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}

var claimsIdentity = await CreateClaimsIdentityAsync(user, authenticationType);
Expand All @@ -146,7 +146,7 @@ public virtual async Task<ClaimsPrincipal> UserIdSignInAsync(Guid id, string aut
}
catch (EntityNotFoundException)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}
}

Expand All @@ -161,7 +161,7 @@ public virtual async Task<ClaimsPrincipal> AuthKeySignInAsync(string key, string
{
if (await userRepository.GetByAuthKeyAsync(key.Trim()) is not User user)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}

var claimsIdentity = await CreateClaimsIdentityAsync(user, authenticationType);
Expand All @@ -170,7 +170,7 @@ public virtual async Task<ClaimsPrincipal> AuthKeySignInAsync(string key, string
}
catch (EntityNotFoundException)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}
}

Expand All @@ -186,7 +186,7 @@ public virtual async Task<ClaimsPrincipal> PasswordSignInAsync(string email, str
{
if (await userRepository.GetByEmailAsync(email.Trim().ToLowerInvariant()) is not User user)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}

if (!await CheckPasswordAsync(user.Id, password.Trim()))
Expand All @@ -195,7 +195,7 @@ public virtual async Task<ClaimsPrincipal> PasswordSignInAsync(string email, str

await userRepository.BumpAccessFailed(user.Id);

throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}

logger.LogInformation("User '{user}' password signin was successful.", user);
Expand All @@ -206,7 +206,7 @@ public virtual async Task<ClaimsPrincipal> PasswordSignInAsync(string email, str
}
catch (EntityNotFoundException)
{
throw new AuthenticationException();
throw new AuthenticationException("Authentication failed.");
}
}
}

0 comments on commit e69631f

Please sign in to comment.