【发布时间】:2020-08-04 13:06:21
【问题描述】:
我想做什么
我正在尝试实施 Google OpenID Connect 作为使用 Google 说明登录 ASP.NET Core 3.1 网站的一种方式:
https://developers.google.com/identity/protocols/oauth2/openid-connect#server-flow
在服务器流的step 2(向 Google 发送身份验证请求)下,他们建议从 their OpenID 发现文档中检索信息:
您应该使用
authorization_endpoint元数据值从 Discovery document 检索基本 URI。
我目前正在尝试通过using Newtonsoft.Json 将JSON 动态反序列化为Dictionary<string, string>。但这给了我一些问题(似乎无法反序列化 JSON string array),我正在考虑改变我的策略,为发现文档创建一个 model 并创建一个 using System.Text.Json 以反序列化。
现在我的问题是
Google 的发现文档对导致我必须更新 DiscoveryDocument.cs model 的更改有多敏感?
困境
使用Newtonsoft.Json 方式,一切仍然有效,即使 Google 决定删除随机密钥。
但现在使用System.Text.Json 对我来说是一种简单的方法,并且消除了对 Newtonsoft 库的依赖,但如果 Google 的 Discovery Document 发生更改,我以后可能会遇到麻烦。
【问题讨论】:
标签: json.net openid-connect asp.net-core-3.1 google-openidconnect