简体   繁体   English

使用RAILS访问Amazon S3上的私有文件

[英]Access to Private files on Amazon S3 with RAILS

I would like to allow users of my website see a special "Image/Video/HTML" but only if they login through facebook connect on my Rails site... 我想允许我网站的用户看到特殊的“图像/视频/ HTML”,但前提是他们通过Facebook登录才能在我的Rails网站上连接...

I would like to use Amazon S3 to store the media.. My question is how do I give limited access to my users only if they are logged in? 我想使用Amazon S3来存储媒体。.我的问题是,仅当我的用户登录后,我如何才能向他们授予有限的访问权限? Once they have the URL of the "Image/Video/HTML" I would not like them to be able to access it unless they are logged in with facebook on my site.. 一旦他们有了“图像/视频/ HTML”的URL,除非他们使用我的网站上的facebook登录,否则我不希望他们能够访问它。

Also, will I be able to continue this kind of private site if I want to use Amazon Cloudfront? 另外,如果我想使用Amazon Cloudfront,是否可以继续这种私有站点?

This is a starting point for whitelisting only my domain... but I want to make sure the user is logged in through fb connect in order to serve them the appropriate resource... 这是仅将我的域列入白名单的起点...但是我想确保用户通过fb connect登录,以便为他们提供适当的资源...

https://gist.github.com/3716433 https://gist.github.com/3716433

I think this depends on how you're including S3 assets in your app. 我认为这取决于您如何在应用程序中包含S3资产。 Here are instructions if you're using paperclip: 如果您使用回形针,则有以下说明:

https://github.com/thoughtbot/paperclip/wiki/Restricting-Access-to-Objects-Stored-on-Amazon-S3 https://github.com/thoughtbot/paperclip/wiki/Restricting-Access-to-Objects-Stored-on-Amazon-S3

Here's another question that deals with this issue using the aws-sdk gem: 这是另一个使用aws-sdk gem处理此问题的问题:

How to store data in S3 and allow user access in a secure way with rails API / iOS client? 如何在Rails API / iOS客户端中将数据存储在S3中并允许用户以安全的方式访问?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM