oauth

package
v0.0.0-...-1814500 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Issuer           string `conf:"issuer"`
	Audience         string `conf:"audience"`
	PermissionPrefix string `conf:"permission_prefix"`
}

type OAuth

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

func New

func New(ctx context.Context, rdb Redis, cfg Config, log logger.Logger) (*OAuth, error)

func (OAuth) ContextAccessToken

func (oa OAuth) ContextAccessToken(ctx context.Context, token string) context.Context

func (OAuth) HasPermissionContext

func (oa OAuth) HasPermissionContext(ctx context.Context, permission string) bool

func (OAuth) IsTokenExpiredError

func (oa OAuth) IsTokenExpiredError(err error) bool

func (OAuth) IsTokenValidationError

func (oa OAuth) IsTokenValidationError(err error) bool

func (OAuth) ProcessTokenContext

func (oa OAuth) ProcessTokenContext(ctx context.Context) (bool, error)

func (OAuth) TokenPermissionKey

func (oa OAuth) TokenPermissionKey(s ...string) string

type Redis

type Redis interface {
	GobGet(ctx context.Context, key string, v any) error
	GobSet(ctx context.Context, key string, v any, exp time.Duration) error
}

Jump to

Keyboard shortcuts

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