Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required decorator does not take into account method #5

Open
FND opened this issue Aug 5, 2015 · 1 comment
Open

required decorator does not take into account method #5

FND opened this issue Aug 5, 2015 · 1 comment

Comments

@FND
Copy link

FND commented Aug 5, 2015

I have a scenario where a route should only be protected by basic auth for certain methods:

@app.route("/items", methods=["GET"])
@basic_auth.required
def list_items():
    ...


@app.route("/items", methods=["POST"])
def create_item():
    ...

That's because POSTing requires a bearer token instead of basic auth:

> GET /items
> Authorization: Basic ...

> POST /items
> Authorization: Bearer ...

However, it seems the required decorator does not take into account the method, so with the code above, both handlers are basic auth-protected.

@mdavis-xyz
Copy link

Why does POSTing require a bearer token?

The Wikipedia page doesn't mention that:
https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants