auth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package auth lets through the requests with a valid token only, and tells the routes which one.

Index

Constants

View Source
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

View Source
var Cookie = config.Current.Name + "_session"

Cookie holds the session token of the web app: HttpOnly, page scripts never see it.

Functions

func Current

func Current(ctx context.Context) domain.Token

Current is the token of the request.

func New

func New(db bun.IDB, next http.Handler) http.Handler

New runs next with the request's token in its context: 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.

func Token

func Token(r *http.Request) string

Token is the request's token, "" without one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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