[英]Use ASP.NET Core WEB API token authentication as a resourceserver with OWIN/Katana OAuth 2.0 Authorization Server
Is it possible to use an ASP.NET Core web api service authentication with an OWIN/Katana OAuth 2.0 Authorization Server? 是否可以将ASP.NET Core Web API服务身份验证与OWIN / Katana OAuth 2.0授权服务器一起使用?
To use the default (Bearer) OAUTH2 access token in ASP.NET 4.5.x WEB API 2 this would be done by adding this: 要在ASP.NET 4.5.x WEB API 2中使用默认的(承载)OAUTH2访问令牌,可以通过添加以下代码来完成:
public void ConfigureAuth(IAppBuilder app)
{
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
And by adding the machinekey to the web.config. 并通过将machinekey添加到web.config。
Is it possible and how to use accesstokens from OWIN/Katana OAuth 2.0 Authorization Server (The tokens are in TicketDataFormat, which is the default) with an ASP.NET Core web api? 是否可以通过ASP.NET Core Web API使用OWIN / Katana OAuth 2.0授权服务器的访问令牌(令牌位于TicketDataFormat,这是默认设置)?
If I remember correctly, there were changes to the token format in ASP.NET Core. 如果我没记错的话,ASP.NET Core中的令牌格式有所更改。 I have a sample of an ASP.NET Core resource server protected by a ported version of the Katana OAuth server. 我有一个受Katana OAuth服务器的移植版本保护的ASP.NET Core资源服务器示例。 Check out the sample code, it may be close enough to get you there. 查看示例代码,它可能已经足够接近您了。
https://github.com/XacronDevelopment/oauth-aspnet/blob/dev/samples/ResourceServer2/Startup.cs https://github.com/XacronDevelopment/oauth-aspnet/blob/dev/samples/ResourceServer2/Startup.cs
I had the same problem, and you need to modify the OAuthServer (to use DataProtector Compatibity or change the AccessTokenFormat to use JWT or other implementation) 我遇到了同样的问题,您需要修改OAuthServer(以使用DataProtector兼容性或将AccessTokenFormat更改为使用JWT或其他实现)
I developed the second option. 我开发了第二种选择。 You can check the JWT solution in https://github.com/aloji/JwtSecurity 您可以在https://github.com/aloji/JwtSecurity中检查JWT解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.