Help us shape the future of Go! Take the 2026 Go Developer Survey

endpointwire

package
v1.152.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package endpointwire mounts endpoints (#2170) on the platform's mux: the /endpoints/{name}/... routes and the bot check's, which authenticate a signed-in caller the way the portal does (a browser session, CSRF-checked on a write, or an API key), and the bot check's settings behind the admin API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(a portalAuth, personas Personas) func(r *http.Request) (*eprun.Caller, error)

Authenticator adapts the portal's authentication to an endpoint's caller, with whether they administer the platform, the persona their roles resolve to and the API key's name, which an authenticated endpoint admits by (#2259). The portal reports an error only for a browser session refused its CSRF token, which is the caller's credential refused rather than absent. A person of an external persona is refused too (#2290): an authenticated endpoint runs a script, which reaches far more than what is shared with them.

func Mount

func Mount(mux *http.ServeMux, p *platform.Platform, adminAuth func() func(http.Handler) http.Handler, author func(*http.Request) string)

Mount registers the routes. A deployment with no database has no endpoints and mounts nothing. The settings routes are mounted where the admin API is on, behind adminAuth.

Types

type Personas added in v1.152.0

type Personas struct {
	External func(roles []string) bool
	Name     func(roles []string) string
	Admin    func(roles []string) bool
}

Personas resolves a caller's roles: whether they are an external persona's, the name of the persona they resolve to ("" for none), and whether the platform's one administrator rule says they administer it. A nil function answers no.

Jump to

Keyboard shortcuts

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