auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TokenExpireDuration = 7 * 24 * time.Hour

Variables

This section is empty.

Functions

func ContextWithToken

func ContextWithToken(ctx context.Context, token *Token) context.Context

Types

type Token

type Token struct {
	ID        TokenID     `json:"id"`
	Secret    TokenSecret `json:"secret" masq:"secret"`
	Sub       string      `json:"sub"`
	Email     string      `json:"email"`
	Name      string      `json:"name"`
	ExpiresAt time.Time   `json:"expires_at"`
	CreatedAt time.Time   `json:"created_at"`
}

func NewToken

func NewToken(sub, email, name string) *Token

func TokenFromContext

func TokenFromContext(ctx context.Context) (*Token, error)

func (*Token) IsExpired

func (x *Token) IsExpired() bool

func (*Token) Validate

func (x *Token) Validate() error

type TokenID

type TokenID string

func NewTokenID

func NewTokenID() TokenID

func (TokenID) String

func (x TokenID) String() string

func (TokenID) Validate

func (x TokenID) Validate() error

type TokenSecret

type TokenSecret string

func NewTokenSecret

func NewTokenSecret() TokenSecret

func (TokenSecret) String

func (x TokenSecret) String() string

Jump to

Keyboard shortcuts

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