-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
Add backend for Hashicorp Vault #668
Conversation
There is a weird interaction between tests.
There is some global state that I can't find - any ideas? |
I found it. The problem is in
This class-level object is shared between all objects which inherit OpenIdConnectTestMixin. And later:
If the access token has 'nonce' set by a previous test, then it doesn't get updated :-( I could just make it set nonce unconditionally, and that makes the tests pass, but I don't want to change it without understanding why |
8f177ea
to
b7b2041
Compare
I've made a more conservative change (I think) which creates a new dict in each subclass. Could you re-run the tests please? |
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
+ Coverage 76.95% 77.03% +0.08%
==========================================
Files 317 319 +2
Lines 9647 9682 +35
Branches 1034 1036 +2
==========================================
+ Hits 7424 7459 +35
Misses 2071 2071
Partials 152 152
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thank you: I see that tests pass now. I have also submitted an alternative, but somewhat more invasive PR, as #669. That PR implements changes to the base OpenIdConnectAuth class to address "NOTE 1/2/3" mentioned in the top of this PR: it changes OpenIdConnectAuth to work as a "generic" backend which can be configured to point to a standard OIDC server without having to subclass it. I hope one or other approach of these PRs is acceptable, but if not, please let me know what you'd like to see instead. |
I think #669 is a better approach, closing this one. |
Proposed changes
This is a new backend for the OIDC Provider in Hashicorp Vault 1.9+
Types of changes
Please check the type of change your PR introduces:
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.
(Not sure what linting you want, but flake8 passes)
Other information
Tested with Netbox
NOTE 1: I had to override the base
OpenIdConnectAuth
class to do HTTP Basic Auth when talking to the token endpoint. Maybe it would be better if functionality were moved into the base class itself, since it can make use of the information exposed in the OIDC discovery response:NOTE 2: I turned OIDC_ENDPOINT into a property, since this is something the user has to configure to point to their own Vault server. Maybe it would be better to turn this into a 'setting' on the
OpenIdConnectAuth
base class.NOTE 3: With those two changes, I would have been able to instantiate the OpenIdConnectAuth class directly - except that it would still need to have a 'name' property. If you set 'name' to 'oidc' here, then it would be usable as a generic OpenID Connect backend. (I made one other change to pick up the 'groups' claim, which is non-standard but commonly implemented)