asp.net-identity – UseOAuthBearerTokens vs UseOAuthBearerAut
发布时间:2020-07-21 21:15:28 所属栏目:asp.Net 来源:互联网
导读:在我们的启动类中,我已经配置了以下认证服务器选项: OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions(){ AllowInsecureHttp = true, TokenEndpointPath = new PathString(/api/v1/tok
在我们的启动类中,我已经配置了以下认证服务器选项: OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true,TokenEndpointPath = new PathString("/api/v1/token"),AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),Provider = new SimpleAuthorizationServerProvider() }; 在这之后,我们应该使用哪个选项来实际启用承载认证?互联网上似乎有两种变化。 选项1: app.USEOAuthAuthorizationServer(OAuthServerOptions); app.USEOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); 选项2: app.USEOAuthBearerTokens(OAuthServerOptions); 我已经测试过他们,两个结果是一样的。 这些选项之间有什么区别?我们什么时候应该使用? 解决方法USEOAuthBearerTokens扩展方法创建令牌服务器和中间件,以验证同一应用程序中的请求的令牌。使用反射器从源代码: USEOAuthAuthorizationServer(); // authorization server middleware USEOAuthBearerAuthentication(ApplicationOAuthBearerProvider); // application bearer token middleware USEOAuthBearerAuthentication(ExternalOAuthBearerProvider); // external bearer token middleware (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net页面SqlCacheDependency缓存实例
- asp.net-mvc – 在MVC命令,优先级和功能问题中授权属性
- ASP.NET MVC删除操作方法中的查询字符串
- asp.net-mvc-4 – Can Castle Windsor可用于在ASP.NET MVC
- asp.net-mvc – ASP.NET MVC路由和静态数据(即图像,脚本等)
- asp.net-mvc – 我可以从服务器端的持票令牌中检索userinfo
- asp-classic – 如何使用Microsoft.XMLHTTP指定代理配置?
- asp.net – 在Azure网站上启用gzip压缩
- asp.net-mvc – 如何在asp.net中使用mvc构建购物车?
- asp.net-mvc – Razor并在ActionLinks上指定css类名
推荐文章
站长推荐
- .net – ELMAH对企业库异常处理块
- webforms – ASP.Net Core 1.0是否支持WebForm项
- 使用SharpZipLib压缩打包多个内存中的文件
- asp.net – 将appsettings.production.json发布到
- asp.net-mvc – 在ajax请求中返回PDF
- ASP.NET MVC3 RAZOR:文件上载给出文件计数为零
- asp.net – 如何使用ajax调用跨域web api?
- ASP.Net MVC 4窗体与2提交按钮/操作
- asp.net-identity交易问题
- asp.net-mvc – ASP.NET MVC的Content / Themes
热点阅读