简体   繁体   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?

I have a webapi in c# and a frontend angular application.我在 c# 和前端 angular 应用程序中有一个 webapi。 The angular application is making calls to active directory services such as azure ad, to get the access token. angular 应用程序正在调用活动目录服务,例如 azure 广告,以获取访问令牌。 While on subsequent webapi calls the web api application needs to validate the access token.在随后的 webapi 调用中,web api 应用程序需要验证访问令牌。

My webapi was using Microsoft.Owin.Security jwt token validation up until now.到目前为止,我的 webapi 一直在使用 Microsoft.Owin.Security jwt 令牌验证。 I want to replace Microsoft.Owin.Security with IdentityModel.OidcClient ( since this is certified c# openid connect library).我想用 IdentityModel.OidcClient 替换 Microsoft.Owin.Security (因为这是经过认证的 c# openid 连接库)。 Please help me out on how to use the OidcClient framework to validate the token.请帮助我了解如何使用 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. 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.

相关问题 如何在 C# 中验证 OpenId 令牌? - How can I validate OpenId token in C#? 使用 System.IdentityModel.Tokens.Jwt 验证在 C# 中生成的令牌 - Verify Token generated in C# with System.IdentityModel.Tokens.Jwt Xamarin 身份验证 Facebook 和谷歌与 IdentityModel.OidcClient 不工作 - Xamarin Authentifiication Facebook & google with IdentityModel.OidcClient not working IdentityModel.OidcClient 中 LoopbackListener 的 Dispose 方法中的 Task.Delay - Task.Delay in Dispose method of LoopbackListener in IdentityModel.OidcClient 如何使用OWIN通过令牌直接通过OpenID Connect进行身份验证 - How can I use OWIN to authenticate with OpenID Connect directly with a token openid connect owin 如何验证来自 Azure AD 的令牌? - How does the openid connect owin validate the token from Azure AD? 如何在 C# 中的 Active Directory 中验证用户 - How to validate the user in Active Directory in C# 如何在ASP.NET WEB API中验证由identityserver4生成的OpenID Connect访问令牌 - How to Validate OpenID Connect Access Token generated by identityserver4 in ASP.NET WEB API 将OpenID Connect与活动目录联合服务(ADFS)结合使用时,如何在id_token中包括其他声明? - How to include an additional claims to the id_token when using OpenID Connect with active directory federation services(ADFS)? C#通过套接字连接在Active Directory中验证用户 - C# verify user in Active Directory from Socket conection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM