开发者

Serving videos from Amazon S3

If I host video or any other media content on Amazon S3, how can I use ASP.net Membership to enforc开发者_如何学Pythone access rights?


S3 permissions

Make sure that you don't grant anonymous read access to your S3 content.

Asp.net security

Setup your asp.net pages so that only logged in users or those with appropriate permissions can visit them

Urls to S3 content

On your Asp.net pages, generate time limited urls to your content on S3. eg Using the AWS SDK for .net to create a pre-signed url in vb.net:

Dim AWSKey As String = "AWS_Key"
Dim AWSSecretKey As String = "AWS_SecretKey"

Using client As AmazonS3 = Amazon.AWSClientFactory.CreateAmazonS3Client(AWSKey, AWSSecretKey)

    Dim req = New Model.GetPreSignedUrlRequest With { _
                   .BucketName = bucket, _
                   .Key = key, _
                   .Protocol = Model.Protocol.HTTPS, _
                   .Verb = Model.HttpVerb.GET, _
                   .Expires = Now.AddDays(ExpiryInDays).AddSeconds(secs) }

    Dim url As String = client.GetPreSignedURL(req)
End Using
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜