-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use IdentitySecurityLogManager instead EventBus to save security logs.
- Loading branch information
Showing
12 changed files
with
115 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...tityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityServerSecurityLogActionConsts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Volo.Abp.IdentityServer | ||
{ | ||
public class IdentityServerSecurityLogActionConsts | ||
{ | ||
public static string LoginSucceeded { get; set; } = "LoginSucceeded"; | ||
|
||
public static string LoginLockedout { get; set; } = "LoginLockedout"; | ||
|
||
public static string LoginNotAllowed { get; set; } = "LoginNotAllowed"; | ||
|
||
public static string LoginRequiresTwoFactor { get; set; } = "LoginRequiresTwoFactor"; | ||
|
||
public static string LoginFailed { get; set; } = "LoginFailed"; | ||
|
||
public static string LoginInvalidUserName { get; set; } = "LoginInvalidUserName"; | ||
|
||
public static string LoginInvalidUserNameOrPassword { get; set; } = "LoginInvalidUserNameOrPassword"; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...tyServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityServerSecurityLogIdentityConsts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Volo.Abp.IdentityServer | ||
{ | ||
public class IdentityServerSecurityLogIdentityConsts | ||
{ | ||
public static string IdentityServer { get; set; } = "IdentityServer"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...bp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/SignInResultExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Microsoft.AspNetCore.Identity; | ||
|
||
namespace Volo.Abp.IdentityServer.AspNetIdentity | ||
{ | ||
public static class SignInResultExtensions | ||
{ | ||
public static string ToIdentitySecurityLogAction(this SignInResult result) | ||
{ | ||
if (result.Succeeded) | ||
{ | ||
return IdentityServerSecurityLogActionConsts.LoginSucceeded; | ||
} | ||
|
||
if (result.IsLockedOut) | ||
{ | ||
return IdentityServerSecurityLogActionConsts.LoginLockedout; | ||
} | ||
|
||
if (result.RequiresTwoFactor) | ||
{ | ||
return IdentityServerSecurityLogActionConsts.LoginRequiresTwoFactor; | ||
} | ||
|
||
if (result.IsNotAllowed) | ||
{ | ||
return IdentityServerSecurityLogActionConsts.LoginNotAllowed; | ||
} | ||
|
||
if (!result.Succeeded) | ||
{ | ||
return IdentityServerSecurityLogActionConsts.LoginFailed; | ||
} | ||
|
||
return IdentityServerSecurityLogActionConsts.LoginFailed; | ||
} | ||
} | ||
} |