HTTP Basic auth support #1252
Replies: 5 comments 3 replies
-
What I'm not clear on is: why not just use a header that isn't overwritten by AWS, such as Otherwise this issue is fairly fuzzy for me – is this a bug? A feature request? (If it's a bug, what is the problem? If it's a feature request, what is the requested feature?) If the issue is to ask best practices for building serverless auth, over at Begin we wrote a guide for auth with Oauth (https://learn.begin.com/basic/state/oauth), although it sounds like given your credential form posting, this may not be what you're looking for. |
Beta Was this translation helpful? Give feedback.
-
Apologies for the Friday evening rambling, let me try and tackle your follow ups with more clarity.
I'd really like to use basic auth so that less technical users can simply visit the URL and get the user/password prompt from their browser. This requires
Both and neither 🙃. Having been bitten by the behaviour difference in Sandbox vs API Gateway, I've added a feature request (#879) to capture that. But when noodling the issue in Slack on Friday, I reached the point of considering Lambda@Edge to write the remapped header back, but struggled to see how you can setup Lambda@Edge against the "hidden" CloudFront distro that API Gateway manages for you. @brianleroux mentioned raising this as an issue as @ryanblock had some experience with Lambda@Edge and Architect. To update you where I've got to since this, I've got the basics working by introducing an Authorizer and creating a macro to deploy that within the Arc realm. However, I'm aware that with a future move to the HTTP variant of API Gateway we lose the ability to use custom authorisers, so an alternative plan would be useful. If we can work out a good way of tackling this, I'm interested in spinning it out in to an open macro anyone can use to secure a staging environment external of anything the app itself does for auth, I feel that must be useful to someone other than just my use case...? |
Beta Was this translation helpful? Give feedback.
-
@andybee yes, if you could please share the macro you created, I'd love to reuse that for the time being. Also, I wasn't aware of custom authorizers not being available in HTTP variant of API Gateway are there any docs on that please? Also also, in your original comment you said:
But then you managed to create a custom authorizer via a macro I assume, so above statement is obsolete? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I've not actually built the macro yet, but it shouldn't be too tricky to get in to shape - I'm just worried about releasing something I know will break once Architect ports over to HTTP API Gateway. Struggling to find an easy thing to link to show that issue, but here's a screenshot when you try and add an authoriser to an HTTP API Gateway: The last bit about not setting the header is obsolete, you can do it but only from an Authorizer. Having a way to do Lambda@Edge still feels like the best possible solution post move to HTTP. |
Beta Was this translation helpful? Give feedback.
-
@andybee i don’t suppose you got anywhere with this? I’m coming to architect via remix.run (having previously done aws deployment via terraform and ECS fargate) so it’s all a little bit new. We were looking to put some Basic Auth on our remix app as a ‘quick’ way to secure it temporarily but alas it’s not seeming that straight forward. If anyone has any pointers it would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
-
This is neither bug nor feature request, but it was suggested in the Slack channel to post this as an issue for further discussion.
The requirement I'm trying to solve is that a client wants to protect their staging environment in such a way that their distributed team can relatively easily open up the staging URL and authenticate to see the web app. What makes matters a bit tricky is that the web app has a classic auth layer built-in (form submission, cookie returned) that needs to remain part of the testing environment with another wrapper over the top.
The easiest idea I had was to wrap the whole thing with HTTP Basic Auth based on
NODE_ENV
beingstaging
. Worked great in Sandbox, failed when deployed to AWS because the path between Lambda, API Gateway and CloudFront out to the web means the outgoing WWW-Authenticate header is rewritten.I came up with a few alternative approaches:
Only alternative I can think of is just coding up a second level of the classic auth within the codebase, just not a huge fan of writing more code than I need to and in such a way that it will be bundled (but not executed) in all environments.
To try and reach a form of conclusion: have I missed something with my attempts or are there any pointers on how some of the bits I hit a blocker with can be overcome? Is this a solved problem in a different way?
Beta Was this translation helpful? Give feedback.
All reactions