token

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 12 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

Index

Constants

View Source
const AuthTokenKey = "auth_token_id"

AuthTokenKey is set in the gin context when a request was authenticated with an access token instead of a browser session.

View Source
const PersonalPrefix = "ahp_"

PersonalPrefix starts every personal access token. Project and node tokens are UUIDs, so the prefix tells the two kinds apart.

Variables

This section is empty.

Functions

func IsPersonal added in v1.1.0

func IsPersonal(value string) bool

IsPersonal tells whether the header value is a personal token.

func NewPersonal added in v1.1.0

func NewPersonal() (plain, stored, hint string, err error)

NewPersonal returns a new personal token, the value to store in AccessToken.Token and a hint (the last characters) to show in lists.

func NodeRoute added in v1.1.0

func NodeRoute(path string) bool

NodeRoute tells whether a node token may be used for the path: the node endpoints of the master (/node/...) and the bundles it installs (/upload/...).

func SessionHandler

func SessionHandler(db *gorm.DB, handler gin.HandlerFunc) gin.HandlerFunc

SessionHandler authenticates requests that carry an X-Auth-Token header and hands every other request to handler (the browser session guard).

func StoredPersonal added in v1.1.0

func StoredPersonal(plain string) string

StoredPersonal returns the stored form (hash) of a personal token.

Types

This section is empty.

Jump to

Keyboard shortcuts

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