如何在单独的服务器上托管受保护的React/Next.js页面以获得最大的保护?

发布于 2025-02-10 07:31:59 字数 399 浏览 0 评论 0原文

我正在制作一个react/next.js应用程序,该应用程序具有一个需要登录名的页面。我看到的每个React/Next.js应用都有一个文件夹页面,其中包含所有页面。我通常会保护需要使用中间件或明确后端运行Passport.js和本地身份验证策略登录的视图。但是,我将如何做到这一点,以便保护的页面实际上托管在单独的URL上?

我知道您可能会认为这是毫无意义的,因为如果主服务器控制身份验证,无法控制该服务器设置任何用户进行身份验证并访问受保护数据的人?

在这种情况下,该攻击向量无关紧要,因为我正在使用所谓的“ LIT协议”,该协议在专用服务器的分散网络上创建了登录JWT,因此欺骗身份验证并不是一个问题。

因此,只是要重申原始问题,我将如何做到这一点,以便保护的页面实际上托管在单独的URL上?我可以从那里拿走。

I am making a React/Next.js app that has a page which requires a login to see. Every React/Next.js app I've seen has a folder pages which contains all of the pages. I usually protect the views that require a login with a middleware or an express backend running Passport.js and a local authentication strategy. But how would I make it so that the page that's protected is actually hosted on a separate url?

I know you might be thinking that this is pointless because if the main server controls authentication, couldn't whoever controls that server set any user to authenticated and access the protected data anyway?

In this case, that attack vector is not relevant because I'm using something called "Lit Protocol" which creates the login JWT on a decentralized network of dedicated servers so spoofing authentication isn't really a problem.

So just to reiterate the original question, how would I make it so that the page that's protected is actually hosted on a separate url? And I can take it from there.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文