admission

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventLogin    = "login"
	EventRegister = "register"
)

Admission event types.

View Source
const V1 = "application/vnd.drone.admission.v1+json"

V1 is version 1 of the admission API

Variables

This section is empty.

Functions

func Handler

func Handler(plugin Plugin, secret string, logs logger.Logger) http.Handler

Handler returns a http.Handler that accepts JSON-encoded HTTP requests for a user, invokes the underlying admission plugin, and writes the JSON-encoded config to the HTTP response.

The handler verifies the authenticity of the HTTP request using the http-signature, and returns a 400 Bad Request if the signature is missing or invalid.

The handler can optionally encrypt the response body using aesgcm if the HTTP request includes the Accept-Encoding header set to aesgcm.

Types

type Plugin

type Plugin interface {
	Admit(context.Context, *Request) (*drone.User, error)
}

Plugin responds to a admission request.

func Client

func Client(endpoint, secret string, skipverify bool) Plugin

Client returns a new plugin client.

type Request

type Request struct {
	Event string     `json:"event,omitempty"`
	User  drone.User `json:"user,omitempty"`
}

Request defines an admission request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL