Authentication in Static Website Hosting

0

Hello, I was recently working with static website hosting in S3 and getting some authentication through Cognito so that only authenticated people can access the webpage. I successfully used the Cognito to authenticate users but what if someone directly accesses the page with the direct URL. For example http://example.com.s3-website.ap-south-1.amazonaws.com/ride.html. If someone visits this URL then they can access the webpage and see the contents. What I need is, only authenticated person can access this page & if some unauthenticated person tries to access it then it shows them "Access Denied" Error or redirect them to login.html. Should I use Cloudfront or there's any other way I can achieve this?

mrrizvi
質問済み 5年前5087ビュー
3回答
1

Hi,
Yes, you will need to use CloudFront to secure the access to your S3 bucket. You will need to follow the steps here:
Link: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html
-randy

回答済み 5年前
0

For a Cognito-based approach, I used the method described in https://aws.amazon.com/blogs/networking-and-content-delivery/authorizationedge-how-to-use-lambdaedge-and-json-web-tokens-to-enhance-web-application-security/.

Edited by: JohnMcGehee on Aug 22, 2020 3:01 PM

回答済み 4年前
  • Hi John, I tried solution that you have mentioned but it is failing to invoke customer lambdas. I changed python runtime from 3.6 to 3.11, were you able to execute launch stake successfully. ?

0

Thank You

mrrizvi
回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ