Documentation ¶
Overview ¶
Package ldap provides a simple ldap client to authenticate, retrieve basic information and groups for a user.
Index ¶
- Constants
- Variables
- func AuthHandler(c *Controller) mux.MiddlewareFunc
- func AuthzHandler(ctlr *Controller) mux.MiddlewareFunc
- func DumpRuntimeParams(log log.Logger)
- func MethodRateLimiter(ctlr *Controller, method string, rate int) mux.MiddlewareFunc
- func RateLimiter(ctlr *Controller, rate int) mux.MiddlewareFunc
- func RunBackgroundTasks(imgStore storage.ImageStore, gc, scrub bool, log log.Logger)
- func SessionAuditLogger(audit *log.Logger) mux.MiddlewareFunc
- func SessionLogger(ctlr *Controller) mux.MiddlewareFunc
- func StartPeriodicTasks(defaultStore storage.ImageStore, subStore map[string]storage.ImageStore, ...)
- func StartPeriodicTasksForImageStore(imageStore storage.ImageStore, configGC bool, configGCInterval time.Duration, ...)
- func WriteData(w http.ResponseWriter, status int, mediaType string, data []byte)
- func WriteDataFromReader(response http.ResponseWriter, status int, length int64, mediaType string, ...)
- func WriteJSON(response http.ResponseWriter, status int, data interface{})
- type AccessController
- type Controller
- func (c *Controller) CORSHandler(response http.ResponseWriter, request *http.Request)
- func (c *Controller) CORSHeaders() mux.MiddlewareFunc
- func (c *Controller) GetPort() int
- func (c *Controller) InitImageStore(reloadCtx context.Context) error
- func (c *Controller) LoadNewConfig(reloadCtx context.Context, config *config.Config)
- func (c *Controller) Run(reloadCtx context.Context) error
- func (c *Controller) Shutdown()
- func (c *Controller) StartBackgroundTasks(reloadCtx context.Context)
- type Error
- type ErrorCode
- type ErrorList
- type ExtensionList
- type ImageManifest
- type ImageTags
- type LDAPClient
- type ReferenceList
- type RepositoryList
- type RouteHandler
- func (rh *RouteHandler) CheckBlob(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) CheckManifest(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) CheckVersionSupport(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) CreateBlobUpload(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) DeleteBlob(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) DeleteBlobUpload(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) DeleteManifest(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) GetBlob(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) GetBlobUpload(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) GetManifest(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) GetMetrics(w http.ResponseWriter, r *http.Request)
- func (rh *RouteHandler) GetReferrers(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) ListExtensions(w http.ResponseWriter, r *http.Request)
- func (rh *RouteHandler) ListRepositories(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) ListTags(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) PatchBlobUpload(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) SetupRoutes()
- func (rh *RouteHandler) UpdateBlobUpload(response http.ResponseWriter, request *http.Request)
- func (rh *RouteHandler) UpdateManifest(response http.ResponseWriter, request *http.Request)
Constants ¶
const ( // actions. CREATE = "create" READ = "read" UPDATE = "update" DELETE = "delete" )
Variables ¶
var ( // NameRegexp is the format for the name component of references. The // regexp has capturing groups for the domain and name part omitting // the separating forward slash from either. NameRegexp = expression( nameComponentRegexp, optional(repeated(literal(`/`), nameComponentRegexp))) )
nolint: gochecknoglobals
Functions ¶
func AuthHandler ¶
func AuthHandler(c *Controller) mux.MiddlewareFunc
func AuthzHandler ¶
func AuthzHandler(ctlr *Controller) mux.MiddlewareFunc
func MethodRateLimiter ¶ added in v1.3.8
func MethodRateLimiter(ctlr *Controller, method string, rate int) mux.MiddlewareFunc
MethodRateLimiter limits handling of incoming requests.
func RateLimiter ¶ added in v1.3.8
func RateLimiter(ctlr *Controller, rate int) mux.MiddlewareFunc
RateLimiter limits handling of incoming requests.
func RunBackgroundTasks ¶ added in v1.4.1
func RunBackgroundTasks(imgStore storage.ImageStore, gc, scrub bool, log log.Logger)
func SessionAuditLogger ¶
func SessionAuditLogger(audit *log.Logger) mux.MiddlewareFunc
func SessionLogger ¶
func SessionLogger(ctlr *Controller) mux.MiddlewareFunc
SessionLogger logs session details.
func StartPeriodicTasks ¶ added in v1.4.1
func StartPeriodicTasks(defaultStore storage.ImageStore, subStore map[string]storage.ImageStore, subPaths map[string]config.StorageConfig, gcEnabled bool, gcInterval time.Duration, extensions *extconf.ExtensionConfig, log log.Logger, )
func StartPeriodicTasksForImageStore ¶ added in v1.4.1
func StartPeriodicTasksForImageStore(imageStore storage.ImageStore, configGC bool, configGCInterval time.Duration, extensions *extconf.ExtensionConfig, log log.Logger, )
func WriteDataFromReader ¶
func WriteJSON ¶
func WriteJSON(response http.ResponseWriter, status int, data interface{})
Types ¶
type AccessController ¶
type AccessController struct { Config *config.AccessControlConfig Log log.Logger }
AccessController authorizes users to act on resources.
func NewAccessController ¶
func NewAccessController(config *config.Config) *AccessController
type Controller ¶
type Controller struct { Config *config.Config Router *mux.Router StoreController storage.StoreController Log log.Logger Audit *log.Logger Server *http.Server Metrics monitoring.MetricServer // contains filtered or unexported fields }
func NewController ¶
func NewController(config *config.Config) *Controller
func (*Controller) CORSHandler ¶ added in v1.4.0
func (c *Controller) CORSHandler(response http.ResponseWriter, request *http.Request)
func (*Controller) CORSHeaders ¶ added in v1.4.0
func (c *Controller) CORSHeaders() mux.MiddlewareFunc
func (*Controller) GetPort ¶ added in v1.4.2
func (c *Controller) GetPort() int
func (*Controller) InitImageStore ¶ added in v1.3.6
func (c *Controller) InitImageStore(reloadCtx context.Context) error
func (*Controller) LoadNewConfig ¶ added in v1.4.0
func (c *Controller) LoadNewConfig(reloadCtx context.Context, config *config.Config)
func (*Controller) Run ¶
func (c *Controller) Run(reloadCtx context.Context) error
func (*Controller) Shutdown ¶
func (c *Controller) Shutdown()
func (*Controller) StartBackgroundTasks ¶ added in v1.4.0
func (c *Controller) StartBackgroundTasks(reloadCtx context.Context)
type Error ¶
type ErrorCode ¶
type ErrorCode int
const ( BLOB_UNKNOWN ErrorCode = iota BLOB_UPLOAD_INVALID BLOB_UPLOAD_UNKNOWN DIGEST_INVALID MANIFEST_BLOB_UNKNOWN MANIFEST_INVALID MANIFEST_UNKNOWN MANIFEST_UNVERIFIED NAME_INVALID NAME_UNKNOWN SIZE_INVALID TAG_INVALID UNAUTHORIZED DENIED UNSUPPORTED INVALID_INDEX )
nolint: golint, stylecheck, revive
type ExtensionList ¶ added in v1.4.1
type ExtensionList struct {
extensions.ExtensionList
}
type ImageManifest ¶
type LDAPClient ¶
type LDAPClient struct { InsecureSkipVerify bool UseSSL bool SkipTLS bool SubtreeSearch bool Port int Attributes []string Base string BindDN string BindPassword string GroupFilter string // e.g. "(memberUid=%s)" Host string ServerName string UserFilter string // e.g. "(uid=%s)" Conn *ldap.Conn ClientCertificates []tls.Certificate // Adding client certificates ClientCAs *x509.CertPool Log log.Logger // contains filtered or unexported fields }
func (*LDAPClient) Authenticate ¶
Authenticate authenticates the user against the ldap backend.
func (*LDAPClient) Connect ¶
func (lc *LDAPClient) Connect() error
Connect connects to the ldap backend.
type ReferenceList ¶
type ReferenceList struct {
References []artifactspec.Descriptor `json:"references"`
}
type RouteHandler ¶
type RouteHandler struct {
// contains filtered or unexported fields
}
func (*RouteHandler) CheckBlob ¶
func (rh *RouteHandler) CheckBlob(response http.ResponseWriter, request *http.Request)
CheckBlob godoc @Summary Check image blob/layer @Description Check an image's blob/layer given a digest @Accept json @Produce json @Param name path string true "repository name" @Param digest path string true "blob/layer digest" @Success 200 {object} api.ImageManifest @Header 200 {object} constants.DistContentDigestKey @Router /v2/{name}/blobs/{digest} [head].
func (*RouteHandler) CheckManifest ¶
func (rh *RouteHandler) CheckManifest(response http.ResponseWriter, request *http.Request)
CheckManifest godoc @Summary Check image manifest @Description Check an image's manifest given a reference or a digest @Router /v2/{name}/manifests/{reference} [head] @Accept json @Produce json @Param name path string true "repository name" @Param reference path string true "image reference or digest" @Success 200 {string} string "ok" @Header 200 {object} cosntants.DistContentDigestKey @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error".
func (*RouteHandler) CheckVersionSupport ¶
func (rh *RouteHandler) CheckVersionSupport(response http.ResponseWriter, request *http.Request)
CheckVersionSupport godoc @Summary Check API support @Description Check if this API version is supported @Router /v2/ [get] @Accept json @Produce json @Success 200 {string} string "ok".
func (*RouteHandler) CreateBlobUpload ¶
func (rh *RouteHandler) CreateBlobUpload(response http.ResponseWriter, request *http.Request)
CreateBlobUpload godoc @Summary Create image blob/layer upload @Description Create a new image blob/layer upload @Accept json @Produce json @Param name path string true "repository name" @Success 202 {string} string "accepted" @Header 202 {string} Location "/v2/{name}/blobs/uploads/{session_id}" @Header 202 {string} Range "0-0" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/blobs/uploads [post].
func (*RouteHandler) DeleteBlob ¶
func (rh *RouteHandler) DeleteBlob(response http.ResponseWriter, request *http.Request)
DeleteBlob godoc @Summary Delete image blob/layer @Description Delete an image's blob/layer given a digest @Accept json @Produce json @Param name path string true "repository name" @Param digest path string true "blob/layer digest" @Success 202 {string} string "accepted" @Router /v2/{name}/blobs/{digest} [delete].
func (*RouteHandler) DeleteBlobUpload ¶
func (rh *RouteHandler) DeleteBlobUpload(response http.ResponseWriter, request *http.Request)
DeleteBlobUpload godoc @Summary Delete image blob/layer @Description Delete an image's blob/layer given a digest @Accept json @Produce json @Param name path string true "repository name" @Param session_id path string true "upload session_id" @Success 200 {string} string "ok" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/blobs/uploads/{session_id} [delete].
func (*RouteHandler) DeleteManifest ¶
func (rh *RouteHandler) DeleteManifest(response http.ResponseWriter, request *http.Request)
DeleteManifest godoc @Summary Delete image manifest @Description Delete an image's manifest given a reference or a digest @Accept json @Produce json @Param name path string true "repository name" @Param reference path string true "image reference or digest" @Success 200 {string} string "ok" @Router /v2/{name}/manifests/{reference} [delete].
func (*RouteHandler) GetBlob ¶
func (rh *RouteHandler) GetBlob(response http.ResponseWriter, request *http.Request)
GetBlob godoc @Summary Get image blob/layer @Description Get an image's blob/layer given a digest @Accept json @Produce application/vnd.oci.image.layer.v1.tar+gzip @Param name path string true "repository name" @Param digest path string true "blob/layer digest" @Header 200 {object} constants.DistContentDigestKey @Success 200 {object} api.ImageManifest @Router /v2/{name}/blobs/{digest} [get].
func (*RouteHandler) GetBlobUpload ¶
func (rh *RouteHandler) GetBlobUpload(response http.ResponseWriter, request *http.Request)
GetBlobUpload godoc @Summary Get image blob/layer upload @Description Get an image's blob/layer upload given a session_id @Accept json @Produce json @Param name path string true "repository name" @Param session_id path string true "upload session_id" @Success 204 {string} string "no content" @Header 202 {string} Location "/v2/{name}/blobs/uploads/{session_id}" @Header 202 {string} Range "0-128" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/blobs/uploads/{session_id} [get].
func (*RouteHandler) GetManifest ¶
func (rh *RouteHandler) GetManifest(response http.ResponseWriter, request *http.Request)
GetManifest godoc @Summary Get image manifest @Description Get an image's manifest given a reference or a digest @Accept json @Produce application/vnd.oci.image.manifest.v1+json @Param name path string true "repository name" @Param reference path string true "image reference or digest" @Success 200 {object} api.ImageManifest @Header 200 {object} constants.DistContentDigestKey @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/manifests/{reference} [get].
func (*RouteHandler) GetMetrics ¶
func (rh *RouteHandler) GetMetrics(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) GetReferrers ¶
func (rh *RouteHandler) GetReferrers(response http.ResponseWriter, request *http.Request)
GetReferrers godoc @Summary Get references for an image @Description Get references for an image given a digest and artifact type @Accept json @Produce json @Param name path string true "repository name" @Param digest path string true "image digest" @Param artifactType query string true "artifact type" @Success 200 {string} string "ok" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /oras/artifacts/v1/{name:%s}/manifests/{digest}/referrers [get].
func (*RouteHandler) ListExtensions ¶ added in v1.4.1
func (rh *RouteHandler) ListExtensions(w http.ResponseWriter, r *http.Request)
ListExtensions godoc @Summary List Registry level extensions @Description List all extensions present on registry @Accept json @Produce json @Success 200 {object} api.ExtensionList @Router /v2/_oci/ext/discover [get].
func (*RouteHandler) ListRepositories ¶
func (rh *RouteHandler) ListRepositories(response http.ResponseWriter, request *http.Request)
ListRepositories godoc @Summary List image repositories @Description List all image repositories @Accept json @Produce json @Success 200 {object} api.RepositoryList @Failure 500 {string} string "internal server error" @Router /v2/_catalog [get].
func (*RouteHandler) ListTags ¶
func (rh *RouteHandler) ListTags(response http.ResponseWriter, request *http.Request)
ListTags godoc @Summary List image tags @Description List all image tags in a repository @Router /v2/{name}/tags/list [get] @Accept json @Produce json @Param name path string true "test" @Param n query integer true "limit entries for pagination" @Param last query string true "last tag value for pagination" @Success 200 {object} api.ImageTags @Failure 404 {string} string "not found" @Failure 400 {string} string "bad request".
func (*RouteHandler) PatchBlobUpload ¶
func (rh *RouteHandler) PatchBlobUpload(response http.ResponseWriter, request *http.Request)
PatchBlobUpload godoc @Summary Resume image blob/layer upload @Description Resume an image's blob/layer upload given an session_id @Accept json @Produce json @Param name path string true "repository name" @Param session_id path string true "upload session_id" @Success 202 {string} string "accepted" @Header 202 {string} Location "/v2/{name}/blobs/uploads/{session_id}" @Header 202 {string} Range "0-128" @Header 200 {object} api.BlobUploadUUID @Failure 400 {string} string "bad request" @Failure 404 {string} string "not found" @Failure 416 {string} string "range not satisfiable" @Failure 500 {string} string "internal server error" @Router /v2/{name}/blobs/uploads/{session_id} [patch].
func (*RouteHandler) UpdateBlobUpload ¶
func (rh *RouteHandler) UpdateBlobUpload(response http.ResponseWriter, request *http.Request)
UpdateBlobUpload godoc @Summary Update image blob/layer upload @Description Update and finish an image's blob/layer upload given a digest @Accept json @Produce json @Param name path string true "repository name" @Param session_id path string true "upload session_id" @Param digest query string true "blob/layer digest" @Success 201 {string} string "created" @Header 202 {string} Location "/v2/{name}/blobs/uploads/{digest}" @Header 200 {object} constants.DistContentDigestKey @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/blobs/uploads/{session_id} [put].
func (*RouteHandler) UpdateManifest ¶
func (rh *RouteHandler) UpdateManifest(response http.ResponseWriter, request *http.Request)
UpdateManifest godoc @Summary Update image manifest @Description Update an image's manifest given a reference or a digest @Accept json @Produce json @Param name path string true "repository name" @Param reference path string true "image reference or digest" @Header 201 {object} constants.DistContentDigestKey @Success 201 {string} string "created" @Failure 400 {string} string "bad request" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /v2/{name}/manifests/{reference} [put].