-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
JIRA client accepts auth options inflexibly #1772
Comments
From my perspective I like the idea. Currently the Jira client init method is bloated with auth stuff. I think it would be great to have an Some points to consider:
|
httpx doesn't support request style auth classes, because the callback may need to be async. But their customization mechanism is pretty similar: https://www.python-httpx.org/advanced/#customizing-authentication |
Problem trying to solve
At work we configure lots of python libraries to do authentication with our internal SSO system, and to do so we've got our own subclasses of
requests.auth.AuthBase
that do mostly well known things like OAuth and Kerberos, but also handle retries and fallback mechanisms in ways that are important to us.Anyway, there seems to be no way to pass either a pre-configured
requests.Session
, or a subclass ofrequests.auth.AuthBase
in toJIRA
's constructor. It accepts the parameters needed to construct a variety ofAuthBase
derivatives, but won't let me say "trust me" and pass an Auth object.Possible solution(s)
Basically, dependency injection: change
JIRA
to accept either aSession
or anAuth
object and use it, instead of it constructing its own. Many (not all, sadly) other libraries let you pass in a Session, but I think actually the way requests is designed it's better to pass in an Auth object, but most people don't.Alternatives
For now I can subclass it and have my constructor do something like
but I don't love monkeying with
self._session
nor that code duplication.Additional Context
I know you're busy and have asked for help with CI. If I can find someone who has some time to propose a PR, we can do that, I just wanted to float the idea as an issue first to see if you hate it.
The text was updated successfully, but these errors were encountered: