【问题标题】:Openiddict implicitflow premature token expirationOpeniddict 隐式流令牌过早过期
【发布时间】:2018-02-11 03:39:30
【问题描述】:

我的 openiddict 配置如下

services.AddOpenIddict(options =>
        {
            options.AddEntityFrameworkCoreStores<TestDbContext>();
            options.AddMvcBinders();
            options.EnableAuthorizationEndpoint("/connect/authorize")
                   .EnableLogoutEndpoint("/connect/logout")
                   .EnableIntrospectionEndpoint("/connect/introspect")
                   .EnableUserinfoEndpoint("/api/userinfo");
            options.AllowImplicitFlow();
            options.RequireClientIdentification();
            options.EnableRequestCaching();
            options.DisableSlidingExpiration();
            options.AddSigningCertificate(
                assembly: typeof(Startup).GetTypeInfo().Assembly,
                resource: "Server.test.pfx",
                password: "test"); // embedded resource
            options.SetAccessTokenLifetime(TimeSpan.FromDays(1));
            options.SetIdentityTokenLifetime(TimeSpan.FromDays(1));
        });

当我在本地测试时,令牌似乎与上面指定的一样长,但在生产(Windows Server 2016 IIS 10)上它过早过期(大约 1 小时)。 netcore1 和 netcore2 都是这种情况。 我知道我可以选择进行静默令牌更新,但现在想避免该过程。这种行为是否有任何已知原因?

【问题讨论】:

标签: asp.net-core iis-10 openiddict


【解决方案1】:

当我在本地测试时,令牌似乎与上面指定的一样长,但在生产(Windows Server 2016 IIS 10)上它过早过期(大约 1 小时)。

默认情况下,OpenIddict 使用 ASP.NET Core 数据保护来加密其访问令牌。

要使数据保护堆栈正常工作,您必须在投入生产时对其进行配置。请参阅OpenIddict: 401 errors when two or more service instance count 了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-05
    • 2022-10-16
    • 1970-01-01
    • 1970-01-01
    • 2021-11-07
    • 2017-01-04
    • 1970-01-01
    • 2022-11-11
    相关资源
    最近更新 更多