authorizations

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseContext added in v1.0.6

func ParseContext(ctx context.Context) (err errors.CodeError)

func Service

func Service(tokens Tokens) (v service.Service)

Types

type FormatTokenParam added in v1.0.6

type FormatTokenParam struct {
	Id          string                `json:"id"`
	UserId      service.RequestUserId `json:"userId"`
	Attributes  *json.Object          `json:"attributes"`
	Expirations time.Duration         `json:"expirations"`
}

func NewFormatTokenParam added in v1.0.6

func NewFormatTokenParam(userId service.RequestUserId) (param FormatTokenParam)

func (*FormatTokenParam) AddAttribute added in v1.0.6

func (param *FormatTokenParam) AddAttribute(key string, value string) FormatTokenParam

type ParsedToken added in v1.0.6

type ParsedToken struct {
	Valid      bool                  `json:"valid"`
	Id         string                `json:"id"`
	UserId     service.RequestUserId `json:"userId"`
	Attributes *json.Object          `json:"attributes"`
	ExpireAT   time.Time             `json:"expireAt"`
}

func Parse added in v1.0.6

func Parse(ctx context.Context, param Token) (result ParsedToken, err errors.CodeError)

type Token

type Token string

func Format added in v1.0.6

func Format(ctx context.Context, param FormatTokenParam) (token Token, err errors.CodeError)

func (Token) String added in v1.0.6

func (token Token) String() string

type Tokens added in v1.0.6

type Tokens interface {
	service.Component
	Format(ctx context.Context, param FormatTokenParam) (token Token, err errors.CodeError)
	Parse(ctx context.Context, token Token) (result ParsedToken, err errors.CodeError)
}

func DefaultTokens added in v1.0.6

func DefaultTokens() Tokens

Jump to

Keyboard shortcuts

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