{"modulePath":"github.com/hyperhq/hypernetes","version":"v1.3.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package webhook\n\nPackage webhook implements the authorizer.Authorizer interface using HTTP webhooks.\n\n## Types\n\n```go\ntype WebhookAuthorizer struct {\n\t*webhook.GenericWebhook\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(kubeConfigFile string, authorizedTTL, unauthorizedTTL time.Duration) (*WebhookAuthorizer, error)\n```\nNew creates a new WebhookAuthorizer from the provided kubeconfig file.\n\nThe config's cluster field is used to refer to the remote service, user refers to the returned authorizer.\n\n\t# clusters refers to the remote service.\n\tclusters:\n\t- name: name-of-remote-authz-service\n\t  cluster:\n\t    certificate-authority: /path/to/ca.pem      # CA for verifying the remote service.\n\t    server: https://authz.example.com/authorize # URL of remote service to query. Must use 'https'.\n\n\t# users refers to the API server's webhook configuration.\n\tusers:\n\t- name: name-of-api-server\n\t  user:\n\t    client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n\t    client-key: /path/to/key.pem          # key matching the cert\n\nFor additional HTTP configuration, refer to the kubeconfig documentation [http://kubernetes.io/v1.1/docs/user-guide/kubeconfig-file.html](http://kubernetes.io/v1.1/docs/user-guide/kubeconfig-file.html).\n\n```go\nfunc (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (err error)\n```\nAuthorize makes a REST request to the remote service describing the attempted action as a JSON serialized api.authorization.v1beta1.SubjectAccessReview object. An example request body is provided bellow.\n\n\t{\n\t  \"apiVersion\": \"authorization.k8s.io/v1beta1\",\n\t  \"kind\": \"SubjectAccessReview\",\n\t  \"spec\": {\n\t    \"resourceAttributes\": {\n\t      \"namespace\": \"kittensandponies\",\n\t      \"verb\": \"GET\",\n\t      \"group\": \"group3\",\n\t      \"resource\": \"pods\"\n\t    },\n\t    \"user\": \"jane\",\n\t    \"group\": [\n\t      \"group1\",\n\t      \"group2\"\n\t    ]\n\t  }\n\t}\n\nThe remote service is expected to fill the SubjectAccessReviewStatus field to either allow or disallow access. A permissive response would return:\n\n\t{\n\t  \"apiVersion\": \"authorization.k8s.io/v1beta1\",\n\t  \"kind\": \"SubjectAccessReview\",\n\t  \"status\": {\n\t    \"allowed\": true\n\t  }\n\t}\n\nTo disallow access, the remote service would return:\n\n\t{\n\t  \"apiVersion\": \"authorization.k8s.io/v1beta1\",\n\t  \"kind\": \"SubjectAccessReview\",\n\t  \"status\": {\n\t    \"allowed\": false,\n\t    \"reason\": \"user does not have read access to the namespace\"\n\t  }\n\t}\n\n","path":"github.com/hyperhq/hypernetes/plugin/pkg/auth/authorizer/webhook","name":"webhook","synopsis":"Package webhook implements the authorizer.Authorizer interface using HTTP webhooks.","isRedistributable":true}
