-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Webhook Token Authenticator #24902
Webhook Token Authenticator #24902
Conversation
@ericchiang @bobbyrullo @erictune @deads2k Mostly in an RFC state right now. I want something exactly like the webhook authorizer, but for token authn. |
if err != nil { | ||
return nil, err | ||
} | ||
serializer := json.NewSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme), false) |
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.
api.Codecs.LegacyCodec(groupVersions...)
would be equivalent, unless you had a concrete reason to init your own
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 just pulled this over from the webhook authorizer. I can change it to use the LegacyCodec if that is a better approach.
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.
Yeah, anyone doing json.NewSerializer like the should be using LegacyCodec
- very few people should ever be using anything except a)
NegotiatedSerializer or b) api.Codecs.LegacyCodec()
On Thu, Apr 28, 2016 at 5:58 PM, CJ Cullen notifications@github.com wrote:
In plugin/pkg/webhook/webhook.go
#24902 (comment)
:+func NewGenericWebhook(kubeConfigFile string, groupVersions []unversioned.GroupVersion) (*GenericWebhook, error) {
- for _, groupVersion := range groupVersions {
if !registered.IsEnabledVersion(groupVersion) {
return nil, fmt.Errorf("webhook plugin requires enabling extension resource: %s", groupVersion)
}
- }
- loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
- loadingRules.ExplicitPath = kubeConfigFile
- loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
- clientConfig, err := loader.ClientConfig()
- if err != nil {
return nil, err
- }
- serializer := json.NewSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme), false)
I just pulled this over from the webhook authorizer. I can change it to
use the LegacyCode if that is a better approach.—
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/24902/files/765d75020629d41818092cba9da5d6a1c4ee3287#r61509591
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.
Done.
) | ||
|
||
// GroupName is the group name use in this package | ||
const GroupName = "authentication.k8s.io" |
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.
to play nice with the client generators, I'm pretty sure you have to put it in a folder called pkg/apis/authentication.k8s.io
I'm having to make that change for authorization.k8s.io in a different pull.
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.
Done.
I like it, but I'd like to see some tests that actually set up the configuration and confirm it works in the same pull that adds the external option. I'm fine merging pulls working up to it without the full check as long as they don't add the option to commands. |
I'll add tests (including some sort of integration test) to this PR. I just wanted to make sure I'm on the right track first. |
limitations under the License. | ||
*/ | ||
|
||
// Package webhook implements the authorizer.Authorizer interface using HTTP webhooks. |
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.
Comment needs update after refactor.
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.
Done.
e6228a5
to
eaf367a
Compare
Fixed up the first round of comments. Leaving the WIP tag on here until I add tests. |
8716b72
to
bb79bf7
Compare
I changed |
GCE e2e build/test passed for commit eb3b0e7. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit eb3b0e7. |
Automatic merge from submit-queue |
Under what circumstance will invoke "webhook" to implements authorization and authentication, and where can I find it in source code? Thanks |
webhook authenticator is not yet documented here: |
Add a webhook token authenticator plugin to allow a remote service to make authentication decisions.