Documentation ¶
Index ¶
- Variables
- func New(options ...Option) services.Service
- func Remove(ctx context.Context, account Id, ids ...Id) (err error)
- func Validate(ctx context.Context) (err error)
- func With(ctx context.Context, authorization Authorization) context.Context
- type Attribute
- type Attributes
- type Authorization
- type Id
- type Option
- type Options
- type Token
- type TokenEncoder
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
Functions ¶
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 List ¶ added in v1.2.0
func List(ctx context.Context, account Id) (v []Authorization, err error)
func (Authorization) Exist ¶
func (authorization Authorization) Exist() bool
func (Authorization) Validate ¶
func (authorization Authorization) Validate() bool
type Id ¶
type Id []byte
func (Id) MarshalJSON ¶ added in v1.2.0
func (*Id) UnmarshalJSON ¶ added in v1.2.0
type Option ¶ added in v1.2.0
type Option func(options *Options)
func WithTokenEncoder ¶ added in v1.2.0
func WithTokenEncoder(encoder TokenEncoder) Option
func WithTokenStore ¶ added in v1.2.0
func WithTokenStore(store TokenStore) Option
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
type TokenStore ¶ added in v1.2.0
type TokenStore interface { services.Component Get(ctx context.Context, account Id, id Id) (v Authorization, has bool, err error) List(ctx context.Context, account Id) (v []Authorization, err error) Save(ctx context.Context, v Authorization) (err error) Remove(ctx context.Context, account Id, ids []Id) (err error) }
Click to show internal directories.
Click to hide internal directories.