OAuth授权服务在ASP.Net MVC 6 [英] OAuth Authorization Service in ASP.Net MVC 6

查看:174
本文介绍了OAuth授权服务在ASP.Net MVC 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网页API 2,你曾经是能够创建一个端点发出经由中间件像下面设立一个OAuth授权服务器令牌:

In Web API 2, you used to be able to create an endpoint to issue a token by setting up an OAuth Authorization Server via middleware like below:

//Set up our auth server options.
var OAuthServerOptions = new OAuthAuthorizationServerOptions()
            {
                AllowInsecureHttp = true,
                TokenEndpointPath = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                Provider = new SimpleAuthorizationServerProvider()
            };

 // Sets up the token issue endpoint using the options above
 app.UseOAuthAuthorizationServer(OAuthServerOptions);

也许我错过了,但我试图找出如何在ASP.Net 5 / MVC 6.我已经通过了源(的 https://github.com/aspnet/Security ),但我真的没有看到类似的事情。有没有做到这一点的新方式?我需要只创建一个控制器和自己做?

Perhaps I'm missing it, but I'm trying to figure out how to do this in ASP.Net 5 / MVC 6. I've looked through the source (https://github.com/aspnet/Security) but I don't really see anything analogous. Is there a new way to accomplish this? Do I need to just create a controller and do it myself?

我怎么看OAuth认证可以通过中间件来设置,但是这方面,我发出从我的API索赔的授权部分。

I see how OAuth Authentication can be set up via Middleware, but this regards the authorization portion where I issue claims from my API.

推荐答案

不要浪费你的时间寻找在ASP.NET 5,ASP的 OAuthAuthorizationServerMiddleware 替代。 NET队干脆决定不将它移植:<一href=\"https://github.com/aspnet/Security/issues/83\">https://github.com/aspnet/Security/issues/83

Don't waste your time looking for an OAuthAuthorizationServerMiddleware alternative in ASP.NET 5, the ASP.NET team simply decided not to port it: https://github.com/aspnet/Security/issues/83

我建议有一个外观的 AspNet.Security.OpenIdConnect.Server ,自带的武士刀3的OAuth2授权服务器中间件的一种先进的叉:有一个OWIN /武士刀3版本,一个ASP .NET 5.0版本,它支持完整的.NET Framework和.NET的核心。

I suggest having a look to AspNet.Security.OpenIdConnect.Server, an advanced fork of the OAuth2 authorization server middleware that comes with Katana 3: there's an OWIN/Katana 3 version, and an ASP.NET 5 version that supports both the full .NET framework and .NET Core.

<一个href=\"https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server\">https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server

祝你好运!

这篇关于OAuth授权服务在ASP.Net MVC 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆