使用ASP.NET Core WEB API令牌身份验证作为资源服务器与OWIN / Katana OAuth 2.0授权服务器

时间:2021-09-22 13:34:24

Is it possible to use an ASP.NET Core web api service authentication with an OWIN/Katana OAuth 2.0 Authorization Server?

是否可以使用OWIN / Katana OAuth 2.0授权服务器的ASP.NET Core Web api服务身份验证?

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?

是否有可能以及如何使用来自OWIN / Katana OAuth 2.0授权服务器的accessstokens(标记在TicketDataFormat中,这是默认设置)和ASP.NET Core web api?

2 个解决方案

#1


0  

If I remember correctly, there were changes to the token format in ASP.NET Core. I have a sample of an ASP.NET Core resource server protected by a ported version of the Katana OAuth server. Check out the sample code, it may be close enough to get you there.

如果我没记错的话,ASP.NET Core中的令牌格式发生了变化。我有一个受核心版Katana OAuth服务器保护的ASP.NET核心资源服务器示例。查看示例代码,它可能足够接近你。

https://github.com/XacronDevelopment/oauth-aspnet/blob/dev/samples/ResourceServer2/Startup.cs

#2


0  

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 Compatibity或更改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解决方案

#1


0  

If I remember correctly, there were changes to the token format in ASP.NET Core. I have a sample of an ASP.NET Core resource server protected by a ported version of the Katana OAuth server. Check out the sample code, it may be close enough to get you there.

如果我没记错的话,ASP.NET Core中的令牌格式发生了变化。我有一个受核心版Katana OAuth服务器保护的ASP.NET核心资源服务器示例。查看示例代码,它可能足够接近你。

https://github.com/XacronDevelopment/oauth-aspnet/blob/dev/samples/ResourceServer2/Startup.cs

#2


0  

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 Compatibity或更改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解决方案