Version: v0.0.0-...-2c2f346 Latest Latest

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 32 Imported by: 0




This section is empty.


View Source
var ThirdPartyMockService = AuthenticationServiceMock{}


func ConnectToDownstreamService

func ConnectToDownstreamService(logger core_logging.ILog, client *core_auth_sdk.Client, response chan interface{}) error

ConnectToDownstreamService attempts to connect to a downstream service

func InitializeAuthnClient

func InitializeAuthnClient(logger core_logging.ILog) (core_auth_sdk.AuthService, error)

InitializeAuthnClient creates a connection to the authn service

func InitializeLoggingEngine

func InitializeLoggingEngine(ctx context.Context) core_logging.ILog

InitializeLoggingEngine initializes logging object

func InitializeMetricsEngine

func InitializeMetricsEngine(serviceName string) *metrics.MetricsEngine

InitializeMetricsEngine initializes a metrics engine globally

func InitializeTracingEngine

func InitializeTracingEngine(serviceName string) (*core_tracing.TracingEngine, io.Closer)

InitializeTracingEngine initiaize a tracing object globally

func MockGRPCService

func MockGRPCService(ctx context.Context, authClientMock core_auth_sdk.AuthService) *grpc.ClientConn

MockGRPCService creates and returns a mock grpc service connection


type AuthenticationServiceMock

type AuthenticationServiceMock struct {
	GetAccountFunc     func(id string) (*core_auth_sdk.Account, error)
	UpdateAccountFunc  func(id, username string) error
	LockAccountFunc    func(id string) error
	UnlockAccountFunc  func(id string) error
	ArchiveAccountFunc func(id string) error
	ImportAccountFunc  func(username, password string, locked bool) (int, error)
	ExpirePasswordFunc func(id string) error
	LoginAccountFunc   func(username, password string) (string, error)
	SignupAccountFunc  func(username, password string) (string, error)
	LogOutAccountFunc  func() error

func (*AuthenticationServiceMock) ArchiveAccount

func (m *AuthenticationServiceMock) ArchiveAccount(id string) error

func (*AuthenticationServiceMock) ExpirePassword

func (m *AuthenticationServiceMock) ExpirePassword(id string) error

func (*AuthenticationServiceMock) GetAccount

func (*AuthenticationServiceMock) ImportAccount

func (m *AuthenticationServiceMock) ImportAccount(username, password string, locked bool) (int, error)

func (*AuthenticationServiceMock) LockAccount

func (m *AuthenticationServiceMock) LockAccount(id string) error

func (*AuthenticationServiceMock) LogOutAccount

func (m *AuthenticationServiceMock) LogOutAccount() error

func (*AuthenticationServiceMock) LoginAccount

func (m *AuthenticationServiceMock) LoginAccount(username, password string) (string, error)

func (*AuthenticationServiceMock) SignupAccount

func (m *AuthenticationServiceMock) SignupAccount(username, password string) (string, error)

func (*AuthenticationServiceMock) UnlockAccount

func (m *AuthenticationServiceMock) UnlockAccount(id string) error

func (*AuthenticationServiceMock) Update

func (m *AuthenticationServiceMock) Update(id, username string) error

type Config

type Config struct {
	Port            int    `mapstructure:"grpc-port"`
	ServiceName     string `mapstructure:"grpc-service-name"`
	RpcDeadline     int    `mapstructure:"grpc-rpc-deadline"`
	RpcRetries      int    `mapstructure:"grpc-rpc-retries"`
	RpcRetryTimeout int    `mapstructure:"grpc-rpc-retry-timeout"`
	RpcRetryBackoff int    `mapstructure:"grpc-rpc-retry-backoff"`

type MockDialOption

type MockDialOption func(context.Context, string) (net.Conn, error)

type RpcOperationFunc

type RpcOperationFunc func() (interface{}, error)

type Server

type Server struct {
	// contains filtered or unexported fields

func NewGRPCServer

func NewGRPCServer(config *Config, client core_auth_sdk.AuthService, logging core_logging.ILog, serviceMetrics *metrics.CoreMetrics,
	metricsEngineConf *core_metrics.CoreMetricsEngine, tracer *core_tracing.TracingEngine) (*Server, error)

NewGRPCServer defines a new instance of the grpc service

func NewMockServer

func NewMockServer(authClientMockStub core_auth_sdk.AuthService) *Server

NewMockServer creates a new mock server instance

func (*Server) AuthenticateAccount

AuthenticateAccount authenticates the current user account against the authentication service ensuring the credentials defined exist

func (*Server) CheckJwtTokenForInValidity

func (s *Server) CheckJwtTokenForInValidity(ctx context.Context, result interface{}, operation string) (error, bool, string)

CheckJwtTokenForInValidity checks jwt token and asserts the token is a valid one.

func (*Server) ConfigureAndStartRootSpan

func (s *Server) ConfigureAndStartRootSpan(ctx context.Context, operationType string) (context.Context, opentracing.Span)

ConfigureAndStartRootSpan configures a parent span object and starts it

func (*Server) CreateAccount

CreateAccount creates a user account via the authentication service

func (*Server) DeleteAccount

DeleteAccount deletes a user account via the authentication service

func (*Server) GetAccount

GetAccount obtains an account as long as the account exists from the context of the authentication service

func (*Server) GetAccountFromResponseObject

func (s *Server) GetAccountFromResponseObject(ctx context.Context, ok bool, result interface{}, operation string) (*core_auth_sdk.Account, error)

GetAccountFromResponseObject obtains an account object from the response object; this account is obtained via an attempted casting operation

func (*Server) GetIdFromResponseObject

func (s *Server) GetIdFromResponseObject(ctx context.Context, response interface{}, operationType string) (int, error)

GetIdFromResponseObject attempts to cast a generic response to a type int and returns the proper value if no errors occurred.

func (*Server) IsPasswordOrEmailInValid

func (s *Server) IsPasswordOrEmailInValid(email string, password string, operationType string) (error, bool)

IsPasswordOrEmailInValid checks request parameters for validity

func (*Server) IsValidEmail

func (s *Server) IsValidEmail(email string, operationType string) (error, bool)

IsValidEmail checks if an email is valid.

func (*Server) IsValidID

func (s *Server) IsValidID(Id uint32, operation string) (error, bool)

IsValidID checks that the ID passed as part of the request parameters is indeed valid.

func (*Server) IsValidPassword

func (s *Server) IsValidPassword(password string, operationType string) (error, bool)

IsValidPassword checks if a password if valid;

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe starts the grpc service

func (*Server) LockAccount

LockAccount locks an account as long as it exists from the context of the authentication service

func (*Server) LogoutAccount

LogoutAccount revokes the user account session from the context of the authentication service

func (*Server) PerformRetryableRPCOperation

func (s *Server) PerformRetryableRPCOperation(ctx context.Context, span opentracing.Span, op proto.DownStreamOperation, opType string) proto.DownStreamOperation

PerformRetryableRPCOperation performs a retryable operation

func (*Server) StartRootSpan

func (s *Server) StartRootSpan(ctx context.Context, operationType string) (context.Context, opentracing.Span)

StartRootSpan starts the rootspan of the current operation at hand

func (*Server) UnLockAccount

UnLockAccount unlocks a user account from the context of the authentication service as long as the account exists

func (*Server) UpdateAccount

UpdateAccount updates the account via the authentication services

Jump to

Keyboard shortcuts

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