kongauth

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiContext

func ApiContext(md metadata.MD, opt *AuthOptions) (context.Context, context.CancelFunc, error)

func ApiContextWithTimeout

func ApiContextWithTimeout(md metadata.MD, dur time.Duration, opt *AuthOptions) (context.Context, context.CancelFunc, error)

func Authenticator

func Authenticator(ctx context.Context, opt *AuthOptions) (context.Context, error)

Authenticator is a helper to authenticate requests sent to upstream from Kong

func CustomIdHeader

func CustomIdHeader() string

func SetCacheExpiration

func SetCacheExpiration(dur time.Duration)

SetCacheExpiration sets the expiration.

This happens once even when called mutiple times.

func SetRedisAuthPrefix

func SetRedisAuthPrefix(prefix string)

SetRedisAuthPrefix sets the redis auth prefix.

This happens once even when called mutiple times.

func SetTableSecretColumn

func SetTableSecretColumn(column string)

SetTableSecretColumn sets the users column to use.

This happens once even when called mutiple times.

func SetUsersTable

func SetUsersTable(tableName string)

SetUsersTable sets the users table to use.

This happens once even when called mutiple times.

Types

type AuthAPI

type AuthAPI interface {
	Authenticator(ctx context.Context) (context.Context, error)
	AuthenticatorWithKey(ctx context.Context, signingKey []byte) (context.Context, error)
}

AuthAPI is an interface that does authentication

type AuthOptions

type AuthOptions struct {
	AuthAPI AuthAPI
	SqlDB   *gorm.DB
	RedisDB *redis.Client
	Logger  grpclog.LoggerV2
}

AuthOptions contains options required for doing kong auth

Jump to

Keyboard shortcuts

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