C# .NET OpenID Connect 教程需要编辑主机文件,但我没有管理员权限?

问题描述 投票:0回答:1

为了学习如何在工作场所使用 net7.0 的

Microsoft.AspNetCore.Authentication.OpenIdConnect
库,我正在遵循在线教程 (https://curity.io/resources/learn/dotnet-openid-connect-website/) .

问题是,教程需要编辑本机的hosts文件,如下:

127.0.0.1  www.example.com login.example.com

由于我在本教程中使用公司的 Windows 11 笔记本电脑,因此我没有编辑主机文件所需的管理员权限。

是否有其他方法可以完成我需要完成的任务(即将

127.0.0.1
映射到两个 url
www.example.com
login.example.com
无需修改主机 - 并且不需要管理员权限?

c# .net openid-connect
1个回答
0
投票

您可以在本地使用 https://localtest.me 和 https://localhost 作为两个不同的域,它们都指向 127.0.0.1。

有关 localtest.me 的更多信息,请访问 https://readme.localtest.me/

然后我用

mkcert -pkcs12 -p12-file localtestme.pfx localtest.me

创建本地信任的证书。 MkCert 可以在 https://github.com/FiloSottile/mkcert

找到
© www.soinside.com 2019 - 2024. All rights reserved.