c# - “IAppBuilder”不包含“UseCookieAuthentication”的定义
问题描述
“IAppBuilder”不包含“UseCookieAuthentication”的定义,并且最佳扩展方法重载“CookieAuthenticationExtensions.UseCookieAuthentication(IAppBuilder, CookieAuthenticationOptions)”需要“IAppBuilder”类型的接收器
public void ConfigureAuth(IAppBuilder app)
{
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>
(ApplicationUserManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
PublicClientId = "self";
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AuthorizeEndpointPath = new
PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14)
};
app.UseOAuthBearerTokens(OAuthOptions);
}
解决方案
您将需要添加对 的程序集引用Microsoft.Owin.Security.Cookies
,您可以从 Nuget 下载它。然后确保也添加使用:
using Microsoft.Owin.Security.Cookies;
推荐阅读
- java - 如何在不使用 block() 的情况下使用 Mono 的返回对象?
- docker - Minikube 在创建时一直失败:StartHost 失败,但会重试:创建主机:创建主机在 120.000000 秒内超时
- javascript - 如何从嵌套的 div 中获取数据
- reactjs - react-select 通过单击组标题添加组中的所有项目
- linux - Gnuplot 4.6 上的 X 斧头
- javascript - Nodejs 无法识别字符串(日文输入)
- javascript - 从 reactJS 中的 JSON 文件动态导入图像
- java - 如何对容器进行 dockerize 以便可以使用或不使用命令行参数运行它?
- javascript - 对 Android 的 WebRTC 支持
- java - Context.startForegroundService() 没有调用 Service.startForeground() 问题