-
Notifications
You must be signed in to change notification settings - Fork 17
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 support for secondary auth in IdentityCredentials #382
Conversation
Can you elaborate on your use case? Are you trying to figure out how to authenticate w/ certificates and also provide a JWT? (I mention this because this is the only case that would need a primary auth w/ a secondary). |
Hey @andrewpmartinez - yes, I am finishing up making authentication with primary and secondary work when secondary is an external jwt. I tested it against the Controller several weeks ago using Postman, and verified that the auth works when using a cert identity along with a JWT bearer on every request. I realized I went a bit too far on this new type, and I'm pairing it down to just augment IdentityCredentials to include a JWT field. |
Cleaning up, removing the custom type and instead overloading the IdentityCredentials type with optional JWT header support. |
This update to sdk-golang now simply adds to the IdentityCredentials type. An example of its use can be seen in the zssh PR I made: openziti-test-kitchen/zssh#31 The existing functionality in Edge is such that, at the end of the |
ffe6698
to
f1fd59d
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 think this would be better as an improvement to BaseCredentials
instead and de-JWT'ed. Rather add a Headers map[string][]string{}
. Then augment the BaseCredentials.AuthenticateRequest to apply those headers to the runtime.ClientRequest
. Then alter all the other credentials first to call self.BaseCredentials.AuthenticateRequest(cr, r)
so that their own logic applies afterward. The existing JWT authenticator can instead set the underlying headers field.
The result is that credentials instantiations can do something like:
jwtStr := getJwt()
cred := NewIdentityCrednetialFromConfig(config)
cred.Headers["authorization"][]string{"Bearter " + jwtStr}
...or any other header that comes along.
Reasoning:
- Placing the functionality here limits the applicability to other cred mechanisms
- Other authentication mechanisms are coming that are not JWTs but have header implications
That would be so much nicer! I'll give that a shot. |
988cc20
to
9b68a6e
Compare
@andrewpmartinez I've refactored credentials.go based on your review. |
9b68a6e
to
7b03987
Compare
Gonna look at this today. |
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.
See comments.
@andrewpmartinez any thoughts? |
- remove extra logic from NewContextWithOpts - remove Method and NewCredentials from BaseCredentials type
cae9141
to
da8597e
Compare
WIP: exploring how to add Secondary Credentials support in the least obtrusive manner