Allow an auth parameter when EnvironBuilder building#1809
Conversation
|
Thanks for the ping, @pgjones! Indeed, I opened #1769 out of concern that Likewise, accepting either a tuple or a What's your thinking on this? Do you expect to not need similar API to facilitate testing other auth schemes for some reason? As I mentioned in #1769, I implemented lightweight WSGI middleware for my ( |
|
We should accept an |
This allows a shorthand for testing basic auth in Werkzeug (and
Flask). Specifically it allows
test_client.get("/", auth=(username, password))
as a shorthand for
credentials = b64encode(b":".join((username.encode(), password.encode())))
headers = {"Authorization": "Basic {}".format(credentials.decode())}
test_client.get("/", headers=headers)
|
I shuffled things around a bit in anticipation of eventually supporting more auth types. It didn't make a lot of sense to me to have a specialty header function when all it does is take an object that could have a method. Instead of a This would probably make sense for the CSP header object as well. |
|
Thanks.
Happy to adopt this (I want to add COOP support as well). |
This allows a shorthand for testing basic auth in Werkzeug (and
Flask). Specifically it allows
as a shorthand for
I'm not sure if the auth param should also allow the
Authenticatedatastructures (alongside the tuple in this PR). This would allow more than just basic auth, but would require the ability to write these headers via the datastructure. @jab do you have a view?