Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Jul 10, 2024
1 parent 2d4dc8a commit 22756f4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
namespace Nager.Authentication.Abstraction.Models
{
/// <summary>
/// Authentication Result
/// </summary>
public class AuthenticationResult
{
/// <summary>
/// Authentication Status
/// </summary>
public AuthenticationStatus Status { get; set; }
public string MfaIdentifier { get; set; }

/// <summary>
/// Mfa Identifier
/// </summary>
public string? MfaIdentifier { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ public async Task<ActionResult<AuthenticationResponseDto>> AuthenticateAsync(
return StatusCode(StatusCodes.Status500InternalServerError);
}
case AuthenticationStatus.MfaCodeRequired:
if (string.IsNullOrEmpty(authenticationResult.MfaIdentifier))
{
return StatusCode(StatusCodes.Status500InternalServerError);
}

return StatusCode(StatusCodes.Status401Unauthorized, new MfaRequiredResponseDto
{
MfaType = "TOTP",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageProjectUrl>https://github.com/nager/Nager.Authentication</PackageProjectUrl>
<PackageTags>Authentication</PackageTags>

<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<Nullable>enable</Nullable>

<Version>2.0.4</Version>
Expand Down
2 changes: 1 addition & 1 deletion src/Nager.Authentication/Nager.Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<RepositoryUrl>https://github.com/nager/Nager.Authentication</RepositoryUrl>

<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>

<Version>2.0.4</Version>
</PropertyGroup>
Expand Down

0 comments on commit 22756f4

Please sign in to comment.