Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ServiceWithEncoder ¶
func ServiceWithEncoder(encoder TokenEncoder) services.Service
func With ¶
func With(ctx context.Context, authorization Authorization)
Types ¶
type Attribute ¶
type Attribute struct {
Key []byte
Value json.RawMessage
}
type Attributes ¶
type Attributes []Attribute
func (*Attributes) Get ¶
func (attributes *Attributes) Get(key []byte, value interface{}) (has bool, err error)
func (*Attributes) Remove ¶
func (attributes *Attributes) Remove(key []byte)
func (*Attributes) Set ¶
func (attributes *Attributes) Set(key []byte, value interface{}) (err error)
type Authorization ¶
type Authorization struct {
Id Id `json:"id"`
Account Id `json:"account"`
Attributes Attributes `json:"attributes"`
ExpireAT time.Time `json:"expireAT"`
}
func Decode ¶
func Decode(ctx context.Context, token Token) (authorization Authorization, err error)
func Load ¶
func Load(ctx context.Context) Authorization
func (Authorization) Exist ¶
func (authorization Authorization) Exist() bool
func (Authorization) Validate ¶
func (authorization Authorization) Validate() bool
type Token ¶
type Token []byte
type TokenEncoder ¶
type TokenEncoder interface {
services.Component
Encode(ctx context.Context, param Authorization) (token Token, err error)
Decode(ctx context.Context, token Token) (result Authorization, err error)
}
func DefaultTokenEncoder ¶
func DefaultTokenEncoder() TokenEncoder
Click to show internal directories.
Click to hide internal directories.