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

feat: add a logging endpoint, cookie HTTP logging handler #467

Open
wants to merge 1 commit into
base: flask-prototype-restx-accepts
Choose a base branch
from

Conversation

chisholm
Copy link
Collaborator

This PR updates the prototype branch to add a protected endpoint for receiving logging data, and a logging handler design which is able to send requests to that endpoint. See src/proto/utils.py.

The handler has a general design which can send cookies with requests. That could include session cookies, but is not a requirement. With respect to the flask prototype though, it must include an authenticated session cookie since the endpoint is protected. If "strong" session protection is in use, one must also be careful to always use the same User-Agent header value, otherwise flask-login will reject the cookie. For that reason, the handler accepts a user_agent argument.

With respect to prototype authentication, it is up to the user of the logging handler to establish a login session. Any cookie(s) from that must be passed to the handler when it is set up (and possibly a correct user agent value too). The handler itself is agnostic to where the cookies come from.

The implementation uses only standard library APIs. That makes it simple to incorporate into other codebases (which is not the plan here, but still a nice thing to think about when designing software components).

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

Successfully merging this pull request may close these issues.

1 participant