runtime

package
v0.0.0-...-fba144e Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Annonymous = userInfo{
		// contains filtered or unexported fields
	}
)

Functions

func NewInvalidProjectInfor

func NewInvalidProjectInfor() invalidProjectInfor

func NewProjectResolver

func NewProjectResolver(log logger.Logger, projectGetter ProjectGetter) *projectResolver

Types

type IdentityResolver

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

func NewIdentityResolver

func NewIdentityResolver(log logger.Logger, userGetter UserGetter) *IdentityResolver

func (*IdentityResolver) UserInfo

func (i *IdentityResolver) UserInfo(ctx context.Context) (UserInfor, bool)

func (*IdentityResolver) WithUserInfo

func (i *IdentityResolver) WithUserInfo(ctx context.Context) context.Context

type ProjectGetter

type ProjectGetter interface {
	GetProject(ctx context.Context, projectId string) (ProjectInfor, error)
}

type ProjectInfor

type ProjectInfor interface {
	GetProjectID() (string, error)
	GetProject(v any) error
}

type ProjectResolver

type ProjectResolver interface {
	// WithProjectInfo set project information into context
	WithProjectInfo(ctx context.Context, reqPath string) context.Context

	// ProjectInfo retrieves project information from context
	ProjectInfo(ctx context.Context) (ProjectInfor, bool)
}

type RequestIdentityResolver

type RequestIdentityResolver interface {
	// WithRequestID set request id (uuid) into context
	WithRequestID(context.Context) context.Context

	// RequestID retrieves request id from context
	RequestID(context.Context) (TypeRequestID, bool)
}

type TypeRequestID

type TypeRequestID string

func (TypeRequestID) String

func (t TypeRequestID) String() string

type TypeUserEmail

type TypeUserEmail string

func NewTypeUserEmail

func NewTypeUserEmail(e string) TypeUserEmail

type TypeUserGroups

type TypeUserGroups []string

func NewTypeUserGroups

func NewTypeUserGroups(gList []string) TypeUserGroups

type TypeUserID

type TypeUserID string

func NewTypeUserID

func NewTypeUserID(s string) TypeUserID

type UUIDRequestIdentityResolver

type UUIDRequestIdentityResolver struct{}

func (*UUIDRequestIdentityResolver) RequestID

func (*UUIDRequestIdentityResolver) WithRequestID

type UserGetter

type UserGetter interface {
	GetUser(ctx context.Context, userSub string) (UserInfor, error)
}

type UserInfor

type UserInfor interface {
	GetUserId() TypeUserID
	GetEmail() TypeUserEmail
	GetGroups() TypeUserGroups
}

type UserResolver

type UserResolver interface {
	// WithUserInfo set user information into context
	WithUserInfo(ctx context.Context) context.Context

	// UserInfo retrieves userinfo from context
	UserInfo(ctx context.Context) (UserInfor, bool)
}

Jump to

Keyboard shortcuts

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