diff --git a/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs b/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs index 33b8086f..0de10328 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs @@ -8,4 +8,5 @@ public interface IAuthenticationHook Task Authenticate(string id, string password); void AddClaims(List claims); void BeforeSending(Token token); + Task UserCreated(User user); } diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs index 6e856b9f..d51b6f4a 100644 --- a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs +++ b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs @@ -1,4 +1,3 @@ -using BotSharp.Abstraction.Repositories; using BotSharp.Abstraction.Users.Models; using Microsoft.Extensions.Configuration; using Microsoft.IdentityModel.Tokens; @@ -57,6 +56,12 @@ public class UserService : IUserService _logger.LogWarning($"Created new user account: {record.Id} {record.UserName}"); Utilities.ClearCache(); + var hooks = _services.GetServices(); + foreach (var hook in hooks) + { + await hook.UserCreated(record); + } + return record; }