usersystem

package module
v0.0.0-...-6f239a5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 3 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContextKeyPayloads = ContextKey("usersession.payloads")
View Source
var ContextKeySession = ContextKey("session")
View Source
var ContextKeySessionType = ContextKey("sessiontype")
View Source
var ContextKeyUID = ContextKey("uid")
View Source
var ContextKeyUsersystem = ContextKey("usersystem")
View Source
var PayloadRevokeCode = "revokecode"
View Source
var PayloadUID = "uid"

Functions

func GetPayloads

func GetPayloads(ctx context.Context) *authority.Payloads

func GetUID

func GetUID(ctx context.Context) string

func PayloadsContext

func PayloadsContext(ctx context.Context, payloads *authority.Payloads) context.Context

func SessionContext

func SessionContext(ctx context.Context, session *Session) context.Context

func SessionTypeContext

func SessionTypeContext(ctx context.Context, st SessionType) context.Context

func UIDContext

func UIDContext(ctx context.Context, uid string) context.Context

Types

type ContextKey

type ContextKey string

type Directive

type Directive interface {
	Execute(*UserSystem) error
}

type DirectiveFactory

type DirectiveFactory func(loader func(v interface{}) error) (Directive, error)

DirectiveFactory herbsystem Directive create factory.

type DirectiveFunc

type DirectiveFunc func(*UserSystem) error

func (DirectiveFunc) Execute

func (f DirectiveFunc) Execute(s *UserSystem) error

type Keyword

type Keyword string

type Session

type Session struct {
	ID       string
	Type     SessionType
	Payloads *authority.Payloads
}

func GetSession

func GetSession(ctx context.Context) *Session

func NewSession

func NewSession() *Session

func (*Session) RevokeCode

func (s *Session) RevokeCode() string

func (*Session) UID

func (s *Session) UID() string

func (*Session) WithID

func (s *Session) WithID(id string) *Session

func (*Session) WithPayloads

func (s *Session) WithPayloads(p *authority.Payloads) *Session

func (*Session) WithType

func (s *Session) WithType(t SessionType) *Session

type SessionStore

type SessionStore interface {
	MustGetSession(sessiontype SessionType, id string) *Session
	MustRevokeSession(code string) bool
}

type SessionType

type SessionType string

func GetSessionType

func GetSessionType(ctx context.Context) SessionType

type UserSystem

type UserSystem struct {
	Keyword Keyword
	*herbsystem.BasicSystem
	// contains filtered or unexported fields
}

func GetUsersystem

func GetUsersystem(ctx context.Context) *UserSystem

func New

func New() *UserSystem

func (*UserSystem) SystemContext

func (u *UserSystem) SystemContext() context.Context

func (*UserSystem) WithKeyword

func (u *UserSystem) WithKeyword(k Keyword) *UserSystem

Jump to

Keyboard shortcuts

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