Documentation
¶
Overview ¶
Package auth lets through the requests with a valid token only, and tells the routes which one.
Index ¶
Constants ¶
const ReadOnlyHeader = "Callback-Read-Only"
ReadOnlyHeader is set to "true" on the answers to a read-only token: the MCP over HTTP leaves out its writing tools.
Variables ¶
var Cookie = config.Current.Name + "_session"
Cookie holds the session token of the web app: HttpOnly, page scripts never see it.
var ErrNotAdmin = domain.Forbidden("this account does not manage the others")
ErrNotAdmin refuses the routes of the accounts to an account that does not run them.
Functions ¶
func New ¶
New runs next with the request's token and its account in its context (domain.UserID): the cookie, or "Authorization: Bearer <token>" for the CLI, scripts and agents. Without a valid one, 401.
func SetCookie ¶
func SetCookie(w http.ResponseWriter, token string, expires time.Time)
SetCookie gives the browser the session token until expires; a zero time deletes it. Secure works on http://localhost too: browsers count it as a secure context.
Types ¶
This section is empty.