session

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermAuthCross        = `auth.cross`
	AnonymousDefaultRole = `anonymous`
)

Permission auth specific constants

View Source
const CrossAuthHeader = "auth.cross.account"

CrossAuthHeader value as AccountID[:UserID]

Variables

This section is empty.

Functions

func Account

func Account(ctx context.Context) *model.Account

Account returns current account model

func Get

Get session storage

func NewCrossAuthHeader

func NewCrossAuthHeader(accid, uid uint64) string

NewCrossAuthHeader from Account & User ID

func ParseCrossAuthHeader

func ParseCrossAuthHeader(val string) (accid, uid uint64)

ParseCrossAuthHeader from value

func Token

func Token(ctx context.Context) string

Token get token from context

func User

func User(ctx context.Context) *model.User

User returns current user model nolint:unused // temporary

func UserAccount

func UserAccount(ctx context.Context) (u *model.User, a *model.Account)

UserAccount returns user + account models

func WithAnonymousUserAccount

func WithAnonymousUserAccount(ctx context.Context) context.Context

WithAnonymousUserAccount puts to context user and account with anonym permissions

func WithSession

func WithSession(ctx context.Context, manager *scs.SessionManager) context.Context

WithSession context wrapper

func WithToken

func WithToken(ctx context.Context, token string) context.Context

WithToken set token to context

func WithUserAccount

func WithUserAccount(ctx context.Context, userObj *model.User, accountObj *model.Account) context.Context

WithUserAccount puts to the context user and account models

func WithUserAccountDevelop

func WithUserAccountDevelop(ctx context.Context) context.Context

WithUserAccountDevelop sets development objects into the context nolint:unused // ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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