我正在使用身份服务器4,我知道它现在在ASP.NET Core上,它很好 .
但我有一个在.NET 4.6.2上的Web API应用程序 . 我想知道如何保护这些API . 或者它可能吗?或者我应该将我的Web API更改为ASP.NET Core?
我到处搜索,但所有样本都是使用ASP.NET Core .
Identity Server 4不关心客户端是什么 . 如果需要,您可以使用控制台应用程序测试ID4,对吗?
你知道,当它归结为它时,所有ID4基本上都是一个REST Web API本身,其中一些众所周知的 endpoints 使用HTTP协议之上的Open ID Connect / oAuth2协议 . 只需在此处查看带有控制台客户端的示例,以便更好地了解您希望如何设置客户端:https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev/Clients .
因此,您的客户端恰好是Web API net462并不重要 . 您所要做的就是将请求发送到托管ID4的网址 . 也许请查看Katana的Open ID Connect中间件,让您更轻松:https://leastprivilege.com/2014/06/12/using-discovery-and-katana-middleware-to-write-an-openid-connect-web-client/ . 顺便提一下,这是指向Identity Server创建者之一的博客的链接 . 我建议你浏览他的博客,找到更多有用的信息 .
Update token validation
对于令牌验证,您需要令牌 endpoints :http://docs.identityserver.io/en/release/endpoints/token.html . 我建议阅读JWT令牌,因为你可以看看Katana JWT中间件:http://odetocode.com/blogs/scott/archive/2015/01/15/using-json-web-tokens-with-katana-and-webapi.aspx .
1 回答
Identity Server 4不关心客户端是什么 . 如果需要,您可以使用控制台应用程序测试ID4,对吗?
你知道,当它归结为它时,所有ID4基本上都是一个REST Web API本身,其中一些众所周知的 endpoints 使用HTTP协议之上的Open ID Connect / oAuth2协议 . 只需在此处查看带有控制台客户端的示例,以便更好地了解您希望如何设置客户端:https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev/Clients .
因此,您的客户端恰好是Web API net462并不重要 . 您所要做的就是将请求发送到托管ID4的网址 . 也许请查看Katana的Open ID Connect中间件,让您更轻松:https://leastprivilege.com/2014/06/12/using-discovery-and-katana-middleware-to-write-an-openid-connect-web-client/ . 顺便提一下,这是指向Identity Server创建者之一的博客的链接 . 我建议你浏览他的博客,找到更多有用的信息 .
Update token validation
对于令牌验证,您需要令牌 endpoints :http://docs.identityserver.io/en/release/endpoints/token.html . 我建议阅读JWT令牌,因为你可以看看Katana JWT中间件:http://odetocode.com/blogs/scott/archive/2015/01/15/using-json-web-tokens-with-katana-and-webapi.aspx .