我正在使用 IdentityServer v4 来处理我的 ASP.NET 应用程序的授权,使用资源所有者流。
我已经实现了IdentityServer4.Core.Services.IProfileService
具有两种方法的接口,GetProfileDataAsync
并且IsActiveAsync
.
向令牌端点发出请求时,GetProfileDataAsync
会按预期调用。我们使用这种方法来发出我们的索赔。
但是,该IsActiveAsync
方法不会被调用。我想实现这个方法来确定用户是否在我们的数据库中处于活动状态。这个方法应该在什么时候被调用?
IdentityServer 源中的注释(见下文)表明它应该在令牌颁发期间被调用,但在请求令牌时不会调用该方法。我怀疑我错过了什么。任何帮助,将不胜感激。
// Summary:
// This method gets called whenever identity server needs to determine
// if the user is valid or active (e.g. if the user's account has been
// deactivated since they logged in). (e.g. during token issuance or
// validation).
Task IsActiveAsync(IsActiveContext context);