identity

package
v0.0.0-...-4263410 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingAccountInContext = errors.New("operation requires account_id in context")

Functions

func AccountId

func AccountId(ctx context.Context) int64

AccountId returns current account model or panics when not set

func AccountIdOrZero

func AccountIdOrZero(ctx context.Context) int64

AccountIdOrZero returns current account model or 0 when not set.

func IdentityHeader

func IdentityHeader(ctx context.Context) string

IdentityHeader returns identity header (base64-encoded JSON)

func WithAccountId

func WithAccountId(ctx context.Context, accountId int64) context.Context

WithAccountId returns context copy with account id value.

func WithIdentity

func WithIdentity(ctx context.Context, id Principal) context.Context

WithIdentity returns context copy with identity.

func WithIdentityFrom64

func WithIdentityFrom64(ctx context.Context, id string) (context.Context, error)

WithIdentityFrom64 returns context copy with identity parsed from base64-encoded JSON string.

Types

type Principal

type Principal = identity.XRHID

func Identity

func Identity(ctx context.Context) Principal

Identity returns identity header struct or nil when not set.

Jump to

Keyboard shortcuts

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