internal

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGeneralFailure       = status.Error(codes.Internal, "ErrGeneralFailure")
	ErrGenerateJwtFailure   = status.Error(codes.Internal, "ErrGenerateJwtFailure")
	ErrClientParamFailure   = status.Error(codes.Internal, "ErrClientParamFailure")
	ErrParseJwtTokenFailure = status.Error(codes.Internal, "ErrParseJwtTokenFailure")
	ErrPermissionDenied     = status.Error(codes.PermissionDenied, "PermissionDenied")
)
View Source
var ServiceModule = fx.Provide(
	func(
		l *zap.Logger,
		sSetting afx.AuthSettingParams,
		aParams mfx.AppParams,
		dbProvider ofx.DocumentStoreParams,
		rcParams ofx.RedisCacheParams,
		redisParams ofx.RedisParams,
	) (rpc sfx.GrpcServiceResult, err error) {
		if coll, e := dbProvider.DriverProvider.OpenDbDriver(sSetting.AuthStoreName); e != nil {
			err = e
		} else {
			if svc, e := NewService(
				l,
				sSetting.JwtTokenSecret,
				sSetting.AuthUrl,
				coll,
				rcParams.RedisCache,
				aParams.AppName,
				otel.GetTracerProvider().Tracer(sSetting.AuthStoreName),
				redisParams.Redis,
				sSetting.JwtTokenExpire,
			); e != nil {
				err = e
			} else {
				rpc.GrpcService = svc
			}
		}
		return
	},
)

Functions

This section is empty.

Types

type Service

type Service struct {
	utility.WithoutAuth
	// contains filtered or unexported fields
}

func NewService

func NewService(
	l *zap.Logger,
	jwtSecret string,
	url string,
	coll diface.ICollection,
	redisCache diface.ICache,
	appName string,
	tracer trace.Tracer,
	redisCli *redis.Client,
	jwtExpire int32,
) (result *Service, err error)

func (*Service) AddBlocked

func (s *Service) AddBlocked(_ context.Context, request *pb.AddBlockedRequest) (*pb.AddBlockedResponse, error)

func (*Service) Authenticate

func (s *Service) Authenticate(_ context.Context, request *pb.AuthenticateRequest) (*pb.AuthenticateResponse, error)

func (*Service) ClearToken

func (s *Service) ClearToken(_ context.Context, request *pb.ClearTokenRequest) (*pb.ClearTokenResponse, error)

func (*Service) Delete

func (s *Service) Delete(_ context.Context, request *pb.DeleteRequest) (*pb.DeleteResponse, error)

func (*Service) PackToken

func (s *Service) PackToken(_ context.Context, request *pb.PackTokenRequest) (*pb.PackTokenResponse, error)

func (*Service) RefreshToken

func (s *Service) RefreshToken(_ context.Context, request *pb.RefreshTokenRequest) (*pb.RefreshTokenResponse, error)

func (*Service) RegisterWithGrpcServer

func (s *Service) RegisterWithGrpcServer(server siface.IGrpcServer) error

func (*Service) ValidateToken

func (s *Service) ValidateToken(_ context.Context, request *pb.ValidateTokenRequest) (*pb.ValidateTokenResponse, error)

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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