簡體   English   中英

如何在 c# webapi 中使用 IdentityModel.OidcClient 來驗證和驗證從支持 openid 連接的活動目錄服務生成的令牌?

[英]How can I use IdentityModel.OidcClient in a c# webapi to verify and validate token generated from active directory service supporting openid connect?

我在 c# 和前端 angular 應用程序中有一個 webapi。 angular 應用程序正在調用活動目錄服務,例如 azure 廣告,以獲取訪問令牌。 在隨后的 webapi 調用中,web api 應用程序需要驗證訪問令牌。

到目前為止,我的 webapi 一直在使用 Microsoft.Owin.Security jwt 令牌驗證。 我想用 IdentityModel.OidcClient 替換 Microsoft.Owin.Security (因為這是經過認證的 c# openid 連接庫)。 請幫助我了解如何使用 OidcClient 框架來驗證令牌。

To validate tokens you should not use IdentityModel.OidcClient, instead you should use the Microsoft.AspNetCore.Authentication.JwtBearer Nuget Package to properly validate JWT tokens in an API.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM