token

package
v0.0.0-...-5167e8f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	Generate(id string, t time.Time) (string, error)
	Validate(token string) (id string, err error)
}

func NewJwtGenerator

func NewJwtGenerator(
	secretKey []byte,
	issuer string,
	apiConfigProvider config.ApiConfigProvider,
) Generator

type MongoStore

type MongoStore struct {
	// contains filtered or unexported fields
}

func NewMongoStore

func NewMongoStore(client mongo.DbClient, logger zerolog.Logger) *MongoStore

func (*MongoStore) Access

func (s *MongoStore) Access(ctx context.Context, id string) error

func (*MongoStore) Count

func (s *MongoStore) Count(ctx context.Context) (int64, error)

func (*MongoStore) Delete

func (s *MongoStore) Delete(ctx context.Context, id string) (bool, error)

func (*MongoStore) DeleteBy

func (s *MongoStore) DeleteBy(ctx context.Context, user, provider string) error

func (*MongoStore) DeleteByUserIDs

func (s *MongoStore) DeleteByUserIDs(ctx context.Context, ids []string) error

func (*MongoStore) DeleteExpired

func (s *MongoStore) DeleteExpired(ctx context.Context) error

func (*MongoStore) Exists

func (s *MongoStore) Exists(ctx context.Context, id string) (bool, error)

func (*MongoStore) Save

func (s *MongoStore) Save(ctx context.Context, token Token) error

type Token

type Token struct {
	ID       string           `bson:"_id"`
	User     string           `bson:"user"`
	Provider string           `bson:"provider,omitempty"`
	Created  datetime.CpsTime `bson:"created"`
	Accessed datetime.CpsTime `bson:"accessed"`

	Expired             *datetime.CpsTime          `bson:"expired,omitempty"`
	ExpiredByInactivity *datetime.CpsTime          `bson:"expired_by_inactivity,omitempty"`
	MaxInactiveInterval *datetime.DurationWithUnit `bson:"max_inactive_interval,omitempty"`
}

Jump to

Keyboard shortcuts

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