-
Notifications
You must be signed in to change notification settings - Fork 53
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
Refactor Authenticators to make use of inheritance #856
Conversation
import pamela | ||
|
||
try: | ||
pamela.authenticate(username, password, service=self.service) | ||
return UserSessionState(username, {}) |
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.
IMO this is clearer than try/except/else: if pamela.authenticate doesn't throw an exception, we go from line 100 to line 101, rather than to line 110, and the happy path all lives together
96a1929
to
c577f06
Compare
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 like this. One depedency-management issue noted in line.
tiled/client/context.py
Outdated
from urllib.parse import parse_qs, urlparse | ||
|
||
import httpx | ||
import platformdirs | ||
|
||
from tiled.server.schemas import AboutAuthenticationProvider |
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.
This pulls in server-side deps. This keeps coming up; maybe we should move these schemas into tiled.schemas
.
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.
If I understand correctly, the schema is being published by the server on some endpoint, and the client is fetching this endpoint to build its understanding of the server? I'd like to when that is done to have a typed object rather than a plain dict. I'll see what can be done.
d990f1b
to
ca28584
Compare
I may rewrite history a little if this passes and move the schema stuff to a seperate PR. |
ca28584
to
5d96a83
Compare
This will be rebased after #862 goes in |
Ready for rebase. Please add a |
af16bcc
to
8816cc7
Compare
8816cc7
to
d1f00f9
Compare
Replaces the use of the Mode enum with inheritance from two abstract base classes that provide different authentication mechanisms. Added some type hints.
Replaced "password" in AboutAuthenticationProvider with "internal", which is then a matching pair with "external".
Checklist