与Identity Server EF集成后,访问令牌未保存在数据库中

时间:2019-04-12 00:45:47

标签: identityserver4

我正在为身份框架4实施EF,以便可以将令牌存储在数据库中。我的问题是,它是否将代码,访问令牌和刷新令牌全部存储在数据库(http://docs.identityserver.io/en/latest/reference/ef.html)中。 在我从上面粘贴的文档链接中实现代码后,我正在获取数据库中的刷新令牌数据,但没有访问令牌。另外,当我尝试从刷新令牌中获取新的访问令牌时,我也获得了新的刷新令牌,但在数据库(PersistedGrants)表中没有看到新的条目。

    StartUp:
                services.AddIdentityServer()
                .AddDeveloperSigningCredential(filename: "key.rsa")
                .AddConfigurationStore(options =>
                {
                    options.ConfigureDbContext = builder =>
                        builder.UseSqlServer(connectionString);
                })
                .AddOperationalStore(options =>
                {
                    options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, sql => sql.MigrationsAssembly(migrationAssembly));
                    // this enables automatic token cleanup. this is optional.
                    options.EnableTokenCleanup = true;
                    options.TokenCleanupInterval = 30; // interval in seconds
                })
                .AddConfigurationStoreCache()

    Client: 
                ClientId =  "testclient",
                ClientName = "testclient",
                ClientSecrets = { "password" },
                AllowedGrantTypes = GrantTypes.Implicit,
                RequireConsent = false,

                RedirectUris = { "https://testapp.azurewebsites.net/signin-oidc"},

                PostLogoutRedirectUris = { "https://testapp.azurewebsites.net/signout-callback-oidc" },

                FrontChannelLogoutUri = "https://testapp.azurewebsites.net/FrontChannelLogout",
                //FrontChannelLogoutUri = "https://testapp.azurewebsites.net/signout-callback-oidc",

                 AllowedScopes = new List<string>
                {
                    "OpenId",
                    "Profile",
                },
                AllowOfflineAccess = true

0 个答案:

没有答案