v2

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertUserSettingFromStore

func ConvertUserSettingFromStore(userSetting *store.UserSetting) *apiv2pb.UserSetting

ConvertUserSettingFromStore converts a user setting from store to protobuf.

func GenerateAccessToken

func GenerateAccessToken(username string, userID int, secret string) (string, error)

GenerateAccessToken generates an access token for web.

func IsAuthenticationAllowed

func IsAuthenticationAllowed(fullMethodName string) bool

IsAuthenticationAllowed returns whether the method is exempted from authentication.

Types

type APIV2Service

type APIV2Service struct {
	Secret  string
	Profile *profile.Profile
	Store   *store.Store
	// contains filtered or unexported fields
}

func NewAPIV2Service

func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store, grpcServerPort int) *APIV2Service

func (*APIV2Service) GetGRPCServer

func (s *APIV2Service) GetGRPCServer() *grpc.Server

func (*APIV2Service) RegisterGateway

func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error

RegisterGateway registers the gRPC-Gateway with the given Echo instance.

type ContextKey

type ContextKey int

ContextKey is the key type of context value.

const (
	// The key name used to store user id in the context
	// user id is extracted from the jwt token subject field.
	UserIDContextKey ContextKey = iota
)

type GRPCAuthInterceptor

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

GRPCAuthInterceptor is the auth interceptor for gRPC server.

func NewGRPCAuthInterceptor

func NewGRPCAuthInterceptor(store *store.Store, secret string) *GRPCAuthInterceptor

NewGRPCAuthInterceptor returns a new API auth interceptor.

func (*GRPCAuthInterceptor) AuthenticationInterceptor

func (in *GRPCAuthInterceptor) AuthenticationInterceptor(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

AuthenticationInterceptor is the unary interceptor for gRPC API.

type MemoService

type MemoService struct {
	apiv2pb.UnimplementedMemoServiceServer

	Store *store.Store
}

func NewMemoService

func NewMemoService(store *store.Store) *MemoService

NewMemoService creates a new MemoService.

func (*MemoService) GetMemo

func (*MemoService) ListMemos

type SystemService

type SystemService struct {
	apiv2pb.UnimplementedSystemServiceServer

	Profile *profile.Profile
	Store   *store.Store
}

func NewSystemService

func NewSystemService(profile *profile.Profile, store *store.Store) *SystemService

NewSystemService creates a new SystemService.

func (*SystemService) GetSystemInfo

type TagService

type TagService struct {
	apiv2pb.UnimplementedTagServiceServer

	Store *store.Store
}

func NewTagService

func NewTagService(store *store.Store) *TagService

NewTagService creates a new TagService.

func (*TagService) ListTags

type UserService

type UserService struct {
	apiv2pb.UnimplementedUserServiceServer

	Store *store.Store
}

func NewUserService

func NewUserService(store *store.Store) *UserService

NewUserService creates a new UserService.

func (*UserService) GetUser

Jump to

Keyboard shortcuts

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