authorization

package
v0.0.0-...-4893f5c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

README

Docker authorization extension api.

Go handler to create external authorization extensions for Docker.

Usage

This library is designed to be integrated in your program.

  1. Implement the authorization.Plugin interface.
  2. Initialize a authorization.Handler with your implementation.
  3. Call either ServeTCP or ServeUnix from the authorization.Handler.
Example using TCP sockets:
  p := MyAuthZPlugin{}
  h := authorization.NewHandler(p)
  h.ServeTCP("test_plugin", ":8080")
Example using Unix sockets:
  p := MyAuthZPlugin{}
  h := authorization.NewHandler(p)
  u, _ := user.Lookup("root")
  gid, _ := strconv.Atoi(u.Gid)
  h.ServeUnix("test_plugin", gid)

Full example plugins

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	sdk.Handler
	// contains filtered or unexported fields
}

Handler forwards requests and responses between the docker daemon and the plugin.

func NewHandler

func NewHandler(plugin Plugin) *Handler

NewHandler initializes the request handler with a plugin implementation.

type Plugin

type Plugin interface {
	AuthZReq(Request) Response
	AuthZRes(Request) Response
}

Plugin represent the interface a plugin must fulfill.

type Request

type Request authorization.Request

Request is the structure that docker's requests are deserialized to.

type Response

type Response authorization.Response

Response is the strucutre that the plugin's responses are serialized to.

Jump to

Keyboard shortcuts

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