【问题标题】:How to customize the OAuthBearerAuthentication for Web api in module-zero-template如何在 module-zero-template 中为 Web api 自定义 OAuthBearerAuthentication
【发布时间】:2020-06-30 08:31:43
【问题描述】:

module-zero-templateStartup 方法的代码中,更改 cookie 身份验证的选项非常简单:

public void Configuration(IAppBuilder app)
{
    app.UseAbp();
   
    app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);  // I want to change the default AccessTokenExpireTimeSpan value, here
    
    app.UseCookieAuthentication(new CookieAuthenticationOptions {
       ExpireTimeSpan = ...,    // this can be simply changed!
       SlidingExpiration = ..., // this can be simply changed!
       ...
     });
   
    ...
}

我想知道如何为UseOAuthBearerAuthentication(参见上一行代码)配置一些选项,以便它们与cookie身份验证的选项保持一致。

问题在于此类配置选项(例如AccessTokenExpireTimeSpanAllowInsecureHttp)仅在OAuthAuthorizationServerOptions 类中可用。

我怎样才能修改上面的代码来做到这一点?

【问题讨论】:

    标签: asp.net-mvc-5 aspnetboilerplate


    【解决方案1】:

    【讨论】:

    • 谢谢你,但这只是为了module-zero-core-template。在我看来,它在module-zero-template 中不可用。我将调查代码并查看如何将其复制到旧版中。
    猜你喜欢
    • 2020-10-19
    • 1970-01-01
    • 2012-10-27
    • 2022-07-27
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    • 1970-01-01
    相关资源
    最近更新 更多