且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在.net核心Web应用程序和Web API之间传递/验证Open ID令牌?

更新时间:2023-02-15 08:11:38

您的ID提供程序(本例中为Okta)将颁发OpenID Connect授权承载令牌,您需要将其传递给要保护的任何应用程序.

Your ID Provider, Okta in this case, will issue an OpenID Connect authorization bearer token that you will need to pass along to any application that you want to protect.

在应用程序的Web Api端,您将需要注册中间件来处理Okta的OpenID Connect令牌.然后,您可以使用[Authorize]装饰控制器/动作,并可以检查身份声明.

On the Web Api side of your application, you will need to register your middleware for handling processing of Okta's OpenID Connect tokens. Then you can decorate your controllers/actions with [Authorize] and you can check an identity's claims.