-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: remove auth middleware #4059
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -959,6 +959,8 @@ def test_log_level(level, defaultenv): | |
assert response.status_code == 200 | ||
|
||
output = sorted(postgrest.read_stdout(nlines=7)) | ||
for line in output: | ||
print(line) | ||
|
||
if level == "crit": | ||
assert len(output) == 0 | ||
|
@@ -974,35 +976,35 @@ def test_log_level(level, defaultenv): | |
output[0], | ||
) | ||
assert re.match( | ||
r'- - postgrest_test_anonymous \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a refactor, this is a regression. The user's role was supposed to be in the log here and that's not the case anymore. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, sorry, forgot to mark this PR as draft. This changed isn't supposed to be done with this refactor. I changed this here to discuss about this. |
||
output[1], | ||
) | ||
assert len(output) == 2 | ||
elif level == "info": | ||
assert re.match( | ||
r'- - - \[.+\] "GET / HTTP/1.1" 500 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET / HTTP/1.1" 200 \d+ "" "python-requests/.+"', | ||
wolfgangwalther marked this conversation as resolved.
Show resolved
Hide resolved
|
||
output[0], | ||
) | ||
assert re.match( | ||
r'- - postgrest_test_anonymous \[.+\] "GET / HTTP/1.1" 200 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET / HTTP/1.1" 500 \d+ "" "python-requests/.+"', | ||
output[1], | ||
) | ||
assert re.match( | ||
r'- - postgrest_test_anonymous \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
output[2], | ||
) | ||
assert len(output) == 3 | ||
elif level == "debug": | ||
assert re.match( | ||
r'- - - \[.+\] "GET / HTTP/1.1" 500 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET / HTTP/1.1" 200 \d+ "" "python-requests/.+"', | ||
output[0], | ||
) | ||
assert re.match( | ||
r'- - postgrest_test_anonymous \[.+\] "GET / HTTP/1.1" 200 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET / HTTP/1.1" 500 \d+ "" "python-requests/.+"', | ||
output[1], | ||
) | ||
assert re.match( | ||
r'- - postgrest_test_anonymous \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
r'- - - \[.+\] "GET /unknown HTTP/1.1" 404 \d+ "" "python-requests/.+"', | ||
output[2], | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now with this approach we can't get the role here, I think we should do this change as a separate
break/fix
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not do the change at all. Why remove the role from the log? It was added there on purpose, I even worked upstream (IIRC wai-logger) to support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I couldn't figure out yet how to get the role after removing the auth middleware. So, I removed it temporarily. I'll try to restore this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me put it this way: I remember introducing the middleware precisely to be able to add the role to the log output. So maybe this refactor is a dead-end. But if you come with a nice way to do it and will overall make the code better, sure.