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
BP-763: Add support for multiple authenticators #122
BP-763: Add support for multiple authenticators #122
Conversation
…e question in my mind about how best to handle returning the errors. For now we are returning the first error with the assumption that the first authenticator is the 'preferred' one.
…ator is still usable via the deprecation wrappers.
…ing a test case for multiple authenticators.
…ult_authenticator is still usable via the deprecation wrappers.
…_authenticators for Rebar.
… HandlerRegistry.handles in favour of authenticators.
Thanks to Rick's awesome deprecation wrapper, this should be backward-compatible until version 3.0. |
@RookieRick Let me know if I should change this to 2.0 I figured I'd play it safe since we are probably getting close to wanting a 2.0 release, but if you're comfortable planning on rolling this in with the marshal_schema changes then that sounds good to me. |
I don't agree with forcing the user to use a list, IMO the user should be able to pass only one authenticator and we convert it to a list in the background. Otherwise it's just more boilerplate for for no reason when you always use one... |
A few comments/suggestions:
Thoughts? |
I'm down to give extra time - honestly we could probably support it indefinitely 😂 |
I think that @Sytten makes a good argument that having to wrap a single Authenticator in a list/tuple is kind of annoying boilerplate. I'm down to lean into type checking to accept either an iterable of Authenticators, a single Authenticator, or None for every However I think that all the class members that store authenticator(s) should store a list or otherwise things like the swagger generation code are going to become unbelievably convoluted. Let me give that a shot and we'll see how it looks. |
…e to pass a single Authenticator as a value based on suggestions.
I think you'll still need to update that coercion lambda: |
I'm not sure that's necessary? |
It's quite possibly overkill.. The hypothetical scenario I had in mind was "existing Rebar user notices that you can now pass a list of Authenticators but fails to notice the change in parameter name and tries to change some existing code to pass |
I'm not really a fan of "fixing programmer errors", but I do think that errors should be as explicit and easy to debug as possible. You do bring up a good point that if a programmer passed What's your thought on changing the lambda to be something like |
Works for me! |
…ror if a non valid value for authenticator is passed by accident (like by a typo which drops the 's'). Made the converter a function instead of re-using a lambda since it's used all over the place now.
…icator_to_authenticators.
Corresponds to Issue #121
deprecated_parameters
decorator to allow a coercion function to convert between old and new styles of parameters.authenticator
parameters as deprecated using the deprecation utils