纯 Javascript 应用程序 +亚马逊S3?

发布于 2024-08-12 10:59:08 字数 247 浏览 1 评论 0原文

我希望确认或反驳以下内容:

对于我到目前为止所读到的内容,不可能仅使用 javascript 编写 Web 应用程序(没有服务器端逻辑),并且由 Amazon S3 提供服务,并且仅将数据存储到 S3,如果您需要有多个客户端,每个客户端都有私有数据。

我看到的问题是每个 Ajax 调用都需要授权标头,这会迫使我将签名(和我的 AWS id)放在页面源中以供每个人查看。

这是正确的还是我误解了文档?

有解决方法吗?

I'm looking to confirm or refute the following:

For what I have read so far it is not possible to write a web application with only javascript -- no server side logic -- served from Amazon S3 that also store data only to S3 if you need to have multiple clients with private data per client.

The issue I see is the Authorization header required for every Ajax call that would force me to put the signature (and my AWS id) right there in the page source for everybody to see.

Is that correct or I misunderstood the docs?

Are there workarounds?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦中的蝴蝶 2024-08-19 10:59:08

简而言之,你是对的。

如果您的 AWS 密钥以任何方式出现在客户端,您就会遇到麻烦。


当然,一个可能的解决方案是让用户指定他们的 AWS 密钥来存储数据。

In short, you are correct.

If your AWS key ends-up in any way on the client-side, you are in trouble.


A possible solution is, of course, to have the user specify their AWS key for storing their data.

七月上 2024-08-19 10:59:08

我正在开发一个项目,该项目将执行与此类似的操作,我的项目将让用户使用他们自己的 S3,我将其存储在 HTML5 localStorage 中。这有点棘手,但我已经掌握了基础知识。

它涉及制作一个 Javascript 程序,将自身复制到 S3 中,从 S3 中获取自身,然后将凭证和控制权传输到 S3 加载的版本中。

我正在使用优秀的 SJCL 来尽可能地进行签名生成和 jQuery 的 ajax 功能。

我的工作只是初始化 S3 端应用程序并对 S3 执行测试 PUT/GET 序列。我还重写了一个 JQuery postMessage 插件(由于缺乏代表,StackOverflow 不允许我发帖)用于在我的框架之间进行通信。

就我而言,我尝试将整个应用程序放入一个 HTML 文件中,这样我就不必向 S3 进行太多的初始传输,但也许还有其他方法可以解决这个问题。

I'm working on a project that will do something similar to this, mine will have the users use their own S3 which I will store in HTML5 localStorage. It's a bit tricky, but I've got the basics working.

It involves making an Javascript program that replicates itself into S3, gets itself from S3 and then transfers credentials and control into the S3 loaded version.

I'm using the excellent SJCL to do signature generation and jQuery's ajax functionality for the parts I can.

My work simply initializes the S3 side application and does a test PUT/GET sequence to S3. I also rewrote a JQuery postMessage plugin (which StackOverflow won't let me post for lack of rep) for communicating between my frames.

In my case, I'm trying to fit the entire application into a single HTML file so that I don't have to do as much initial transfer into S3, but perhaps there are other ways to work this out.

野侃 2024-08-19 10:59:08

iBeans 提供了一种解决此问题的方法,而无需编写任何服务器端代码。有一个 S3 iBean(开发人员正在开发它,并将在未来几天内发布 - 观看 mulesoft 博客以获得公告),您可以直接从 JavaScript 访问它。 iBean 本身在服务器上运行,因此您无需将密钥存储在 javascript 中。

iBeans offers a way around this without having to write any server side code. There's an S3 iBean (a developer is working on it to be released in the next few days - watch the mulesoft blog for an announcement) and you can access it right from your javascript. The iBean itself runs on a server so you wouldn't need to store your keys in the javascript.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文