One ALB, one HTTPS listener, one TG - can I have both authorised requests with Cognito and Non-authorised requests?

0

Hi, can someone please let me know if this is a viable solution and if it's even possible. I have an Application Load Balancer sitting in front of my Target Group which is linked to my ECS Cluster where I have deployed a monolith that contains frontend user routing that doesn't require authentication as well as admin routing that does require authentication. Lets say my load balancer is www.example-alb.com - can I still use Cognito as an IdP where I have for example a path condition based rules on my listener that check whether the request is (1) www.example-alb.com/user or (2) www.example-alb.com/admin and if its (1) the request doesn't need to be authenticated and gets forwarded to the target group whereas if its (2) the request does need to be authenticated first and then forwarded to the target group.

Once the request reaches the target group then the routing authentication logic will verify the token or whatever for the admin paths.

Is this reasonable/viable , can it work or its not really how things are done?

1 個回答
1
已接受的答案

Hello.

I think what you want to do is probably possible.
I think it's okay if you create a listener rule that sets Cognito authentication in the case of "/admin/*" and does not set Cognito authentication in other cases.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html https://arpadt.com/articles/alb-auth-with-cognito

The article below is in Japanese, but it explains what you want to do.
https://blog.shibayu36.org/entry/2020/09/23/180000

profile picture
專家
已回答 4 個月前
  • Thanks this is a really helpful answer - and I was able to translate the Japanese article to English with Google Translate so that was also quite helpful to see that someone has actually done this and wrote about it!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南