Documentation ¶
Index ¶
- Variables
- func New(options ...Option) services.Service
- func Remove(ctx context.Context, account Id, ids ...Id) (err error)
- func ValidateContext(ctx context.Context) (err error)
- func With(ctx context.Context, authorization Authorization) context.Context
- type Attribute
- type Attributes
- type Authorization
- type Config
- type CreateParam
- type CreateResult
- type Id
- type Option
- type Options
- type Token
- type TokenEncoder
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ValidateContext ¶ added in v1.2.83
Types ¶
type Attribute ¶
type Attribute struct { Key []byte `json:"key" avro:"key"` Value json.RawMessage `json:"value" avro:"value"` }
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" avro:"id"` Account Id `json:"account" avro:"account"` Attributes Attributes `json:"attributes" avro:"attributes"` ExpireAT time.Time `json:"expireAT" avro:"expireAt"` }
func List ¶ added in v1.2.0
func List(ctx context.Context, account Id) (v []Authorization, err error)
func Validate ¶
func Validate(ctx context.Context, token Token) (authorization Authorization, err error)
func (Authorization) Exist ¶
func (authorization Authorization) Exist() bool
func (Authorization) Validate ¶
func (authorization Authorization) Validate() bool
type CreateParam ¶ added in v1.2.83
type CreateParam struct { Id Id `json:"id" avro:"id"` Account Id `json:"account" avro:"account"` Attributes Attributes `json:"attributes" avro:"attributes"` }
type CreateResult ¶ added in v1.2.83
type CreateResult struct { Token Token `json:"token" avro:"token"` Authorization Authorization `json:"authorization" avro:"authorization"` }
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 HmacTokenEncoder ¶ added in v1.3.0
func HmacTokenEncoder() 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) }
func SharingTokenStore ¶ added in v1.3.0
func SharingTokenStore() TokenStore
Click to show internal directories.
Click to hide internal directories.