-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from NerosoftDev/develop
Develop
- Loading branch information
Showing
34 changed files
with
557 additions
and
319 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
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
54 changes: 54 additions & 0 deletions
54
Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Auth.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,54 @@ | ||
using Nerosoft.Euonia.Bus; | ||
using Nerosoft.Starfish.Domain; | ||
|
||
namespace Nerosoft.Starfish.Application; | ||
|
||
internal partial class LoggingEventSubscriber | ||
{ | ||
private const string MODULE_AUTH = "auth"; | ||
|
||
/// <summary> | ||
/// 处理用户认证成功事件 | ||
/// </summary> | ||
/// <param name="event"></param> | ||
/// <param name="context"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <exception cref="NotImplementedException"></exception> | ||
[Subscribe] | ||
public Task HandleAsync(UserAuthSucceedEvent @event, MessageContext context, CancellationToken cancellationToken = default) | ||
{ | ||
var command = new OperateLogCreateCommand | ||
{ | ||
Module = MODULE_AUTH, | ||
Type = @event.AuthType, | ||
UserName = @event.UserName, | ||
OperateTime = DateTime.Now, | ||
Description = Resources.IDS_MESSAGE_LOGS_AUTH_SUCCEED, | ||
RequestTraceId = context.RequestTraceId | ||
}; | ||
return _bus.SendAsync(command, new SendOptions { RequestTraceId = context.RequestTraceId }, null, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// 处理用户认证失败事件 | ||
/// </summary> | ||
/// <param name="event"></param> | ||
/// <param name="context"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <exception cref="NotImplementedException"></exception> | ||
[Subscribe] | ||
public Task HandleAsync(UserAuthFailedEvent @event, MessageContext context, CancellationToken cancellationToken = default) | ||
{ | ||
var command = new OperateLogCreateCommand | ||
{ | ||
Module = MODULE_AUTH, | ||
Type = @event.AuthType, | ||
Description = Resources.IDS_MESSAGE_LOGS_AUTH_FAILED, | ||
OperateTime = DateTime.Now, | ||
RequestTraceId = context.RequestTraceId, | ||
Error = @event.Error | ||
}; | ||
|
||
return _bus.SendAsync(command, new SendOptions { RequestTraceId = context.RequestTraceId }, null, cancellationToken); | ||
} | ||
} |
Oops, something went wrong.