diff --git a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj
index e94cf839..474dcf56 100644
--- a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj
+++ b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj
@@ -32,6 +32,7 @@
+
diff --git a/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs b/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs
index afb0e40e..36b07f11 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs
@@ -1,15 +1,60 @@
using BotSharp.Abstraction.Users.Models;
+using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
namespace BotSharp.Abstraction.Users;
public interface IAuthenticationHook
{
+ ///
+ /// Interupt the authentication process, and return the user object if the user is authenticated
+ ///
+ ///
+ ///
+ ///
Task Authenticate(string id, string password);
- void AddClaims(List claims);
- void BeforeSending(Token token);
+
+ ///
+ /// Add extra claims to user
+ ///
+ ///
+ ///
+ bool AddClaims(List claims)
+ => true;
+
+ ///
+ /// User authenticated successfully
+ ///
+ ///
+ ///
+ bool UserAuthenticated(JwtSecurityToken token)
+ => true;
+
+ ///
+ /// Bfore user updating
+ ///
+ ///
+ ///
Task UserUpdating(User user);
+
+ ///
+ /// After user created
+ ///
+ ///
+ ///
Task UserCreated(User user);
+
+ ///
+ /// Reset password
+ ///
+ ///
+ ///
Task VerificationCodeResetPassword(User user);
+
+ ///
+ /// Delete users
+ ///
+ ///
+ ///
Task DelUsers(List userIds);
}
diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs
index 10dbe8de..5d08c51f 100644
--- a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs
+++ b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs
@@ -275,7 +275,7 @@ public class UserService : IUserService
foreach (var hook in hooks)
{
- hook.BeforeSending(token);
+ hook.UserAuthenticated(jwt);
}
return token;