如何防止从网址访问Web API

发布于 2025-01-27 21:13:28 字数 733 浏览 2 评论 0原文

对不起,如果提出问题之前。我搜索了,但找不到解决问题的方法。

我有一个Web API(我不使用OWIN或类似的东西)。 API从带有应用程序发送的数据中创建任务,并返回TaskID和PageID以将其作为GET/POST参数传递到网站。之后,集成Web API的应用程序,将重定向到我的Web应用程序的一个页面之一,以完成我的Web API创建的任务。我有一些安全流,例如用于控制访问的应用程序的Appid-Password。但这有一些安全问题。

如果客户与其他人共享苹果和密码,则可以通过不允许的应用程序使用Appid密码信息。

这是我试图解决问题的方法, 我尝试获取httpcontext.current.requrest.headers [“ oneration”]信息,但是使我的Web API的应用程序必须发送标题,并且无法解决问题。因为相同的“原点”标头可以通过一堆应用程序发送。我尝试使用httpcontext.current.requrest.headers [“ remote_addr”]httpcontext.current.requrest.requrest.headers.headers [“ emotegry_host”]和两个返回客户应用程序IP地址的地址。这些也不可以解决我的问题。因为在一台服务器中可能会有数千个应用程序。我试图从IP地址求解DNS,但是我无法实现此目标,因为该应用程序可能无法注册,也无法通过外部网络访问。

解决此问题的最佳方法是什么?感谢您的帮助。

Sorry if the question is asked before. I searched but i can't find a way to solve my problem.

I have a web api (i don't use owin or something like that). The api creates task from data with sent by application and returns the taskId and pageId to application to pass it as get/post parameter to website. After that, The application that integrate the web api, redirect to one of my web application's page to complete the task created by my web api. I have some security flows such as appid-password to control accessed application. But this has some security problem.

If a customer share the appid and password with another person, then appid password info could use by a disallowed application.

Here is what i tried to solve the problem,
I tried to get HttpContext.Current.Request.Headers["Origin"] info but the application that entegrate my web api must send the header and it could not solve the problem. Because same "Origin" header can be sent by bunch of applications. I try to use the HttpContext.Current.Request.Headers["REMOTE_ADDR"] or HttpContext.Current.Request.Headers["REMOTE_HOST"] and both of returns the IP address of customer's application's IP Address. And these are could'not solve my problem too. Because in one server there may be thousands of applications. I tried to solve the Dns from an IP address but i could not achieve this because the entegrated application may not registered or it can't be accessible by outside network.

What is the best way to solve this problem? Thanks for helps.

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

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

发布评论

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