IdentityServer 4:未指定授予的存储机制-使用AddInMemoryStores [英] IdentityServer 4: No storage mechanism for grants specified - use AddInMemoryStores

查看:340
本文介绍了IdentityServer 4:未指定授予的存储机制-使用AddInMemoryStores的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Identity Server 4和ASP.NET Core,并试图在生产环境中替换IdentityServer开发人员.但是出现以下错误:

I am using Identity Server 4 , ASP.NET Core and trying to replace the IdentityServer developer in Production environment. But getting the following error:

No storage mechanism for grants specified. Use the 'AddInMemoryStores' extension method to register a development version.

因此,我尝试实现此

  • IProfileService
  • IResourceOwnerPasswordValidator
  • 这是我在 Startup 类中的 ConfigureServices 方法:

                services.AddMvc();
                var identityBuilder = services.AddIdentityServer();
                identityBuilder.AddInMemoryScopes(identitySrvConfig.GetScopes());
                identityBuilder.AddInMemoryClients(identitySrvConfig.GetClients());
                identityBuilder.AddProfileService<ProfileService>();
                identityBuilder.Services.AddTransient<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();
    

    考虑到我的情况,接口签名是不同的:

    Taking into consideration that in my case the interface signature is different:

     public class ResourceOwnerPasswordValidator : IdentityServer4.Validation.IResourceOwnerPasswordValidator
    {
        public Task ValidateAsync(ResourceOwnerPasswordValidationContext context)
        {
            throw new NotImplementedException();
        }
    }
    

    但是我仍然遇到相同的错误,这是什么问题?

    But I am still getting the same error, what is the problem?

    推荐答案

    他们正在/正在修改这些API.您应该使用

    They were/are reworking those APIs. You should use AddInMemoryPersistedGrants

    这篇关于IdentityServer 4:未指定授予的存储机制-使用AddInMemoryStores的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆