-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Insensible defaults in constructors #88
Comments
Not very easy is mildly put considering this is still very much in development and I would not even consider it alpha as the api changes with almost every commit =) Well done on figuring it all out! There will be a guide / tutorial / some docs detailing how to implement an oauth 2 provider and as you hint it would be a good idea to assert that the various classes are initialized correctly as to avoid weird errors down the road. One example of api change is that I'm trying to move to inheritance by composition style (request validator) and avoid having to subclass just to override a method or two (save_token) but this is still not complete. The reason of the oauth 2 provider taking so long is a mix of very limited time on my side and the extreme flexibility of the protocol making an implementation that nicely support all of it tricky. The seemingly insensible defaults stems from the defaults not imposing any specific grant type or token type on the developer and thus everyone is forced to actively pick them and supply them. This might change in the future depending on what people wish for... |
I understand that it is hard to impose a specific grant type, but I guess we could impose that people insert something of their own rather than I'll see if I can make a sensible PR |
I've update the provider quite substantially and begun working on some docs, readable at https://oauthlib.readthedocs.org/en/latest/server2.html#creating-an-oauth-2-provider I'm playing around with the idea of having different pre-configured endpoints associated with certain grant types. Also, the constructor defaults are now gone as all arguments are required. |
Hi,
I needed a really simple OAuth 2 server implementation to test my client against, and figured I would use this lib. I is not very easy, partly because you have to go back and forth through the source code, and quite some class constructors have arguments with defaults that don't make sense, as you can't use the class with those defaults.
I'll give some examples:
response_types
needs to be a dict with with at least one grant type class.default_token
can be leftNone
, but that will result in an error later on, astokens.BearerToken
is a placeholder-class that needs to be overriden to define it'ssave_token
method.Later on
self.request_validator
is assumed a class with methods, and notNone
. If will fail with an obscureAttributeError: 'NoneType' object has no attribute 'validate_bearer_token
.So I think we should make them all args instead of kwargs, or at least fail if they are ill defined.
The text was updated successfully, but these errors were encountered: