auth

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 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 carries the verified caller identity through the request context. The middleware in internal/auth.go is the only writer; handlers only read.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUser = errors.New("no authenticated user")

Functions

func CompanyID added in v0.16.0

func CompanyID(r *http.Request) string

CompanyID returns the company an integration token belongs to, empty for user requests.

func EmailDomain

func EmailDomain(r *http.Request) string

EmailDomain returns the lower-cased domain of the caller's verified primary email.

func UserID

func UserID(r *http.Request) (string, error)

UserID returns the verified user id for the request.

func WithCompany added in v0.16.0

func WithCompany(ctx context.Context, companyId string) context.Context

WithCompany marks the request as made by an integration token for the given public company id.

func WithUser

func WithUser(ctx context.Context, u User) context.Context

Types

type User

type User struct {
	ID    string
	Email string // verified primary email, empty in the development bypass
}

Jump to

Keyboard shortcuts

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