userinfo

package module
Version: v0.0.0-...-c9ecf27 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthValidation

func BasicAuthValidation(ctx context.Context, db *gorm.DB) error

BasicAuthValidation It will check the user id present in context is valid or not

func GetClientIP

func GetClientIP(ctx context.Context) string

func IsGrpcCall

func IsGrpcCall(ctx context.Context) bool

func NewContext

func NewContext(ctx context.Context, u UserInfo) context.Context

func NewContextForGrpcCall

func NewContextForGrpcCall(ctx context.Context) context.Context

func NewContextWithClientIP

func NewContextWithClientIP(ctx context.Context, ip string) context.Context

func WithClaims

func WithClaims(ctx context.Context, c map[string]interface{}) context.Context

Types

type UserInfo

type UserInfo struct {
	ID          string
	Email       string
	Sub         string
	TokenExpiry time.Time
}

func FromClaims

func FromClaims(claims map[string]interface{}) (ui UserInfo)

func FromContext

func FromContext(ctx context.Context) (usr UserInfo)

FromContext returns the User value stored in ctx, if any.

type ValidateUserInfo

type ValidateUserInfo struct {
	Ctx          context.Context
	RootTable    interface{}
	RootTableTag string
	//Key Will be tag name
	Args               map[string]interface{}
	SkipRootValidation bool
	SkipArgsValidation bool
	Db                 *gorm.DB
	// contains filtered or unexported fields
}

func (*ValidateUserInfo) ValidateUser

func (validateUserInfo *ValidateUserInfo) ValidateUser() error

ValidateUser Validate User : Will validate user id is present in the given table or not

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL