Documentation ¶
Index ¶
- Variables
- func ConnectToDownstreamService(logger core_logging.ILog, client *core_auth_sdk.Client, ...) error
- func InitializeAuthnClient(logger core_logging.ILog) (core_auth_sdk.AuthService, error)
- func InitializeLoggingEngine(ctx context.Context) core_logging.ILog
- func InitializeMetricsEngine(serviceName string) *metrics.MetricsEngine
- func InitializeTracingEngine(serviceName string) (*core_tracing.TracingEngine, io.Closer)
- func MockGRPCService(ctx context.Context, authClientMock core_auth_sdk.AuthService) *grpc.ClientConn
- type AuthenticationServiceMock
- func (m *AuthenticationServiceMock) ArchiveAccount(id string) error
- func (m *AuthenticationServiceMock) ExpirePassword(id string) error
- func (m *AuthenticationServiceMock) GetAccount(id string) (*core_auth_sdk.Account, error)
- func (m *AuthenticationServiceMock) ImportAccount(username, password string, locked bool) (int, error)
- func (m *AuthenticationServiceMock) LockAccount(id string) error
- func (m *AuthenticationServiceMock) LogOutAccount() error
- func (m *AuthenticationServiceMock) LoginAccount(username, password string) (string, error)
- func (m *AuthenticationServiceMock) SignupAccount(username, password string) (string, error)
- func (m *AuthenticationServiceMock) UnlockAccount(id string) error
- func (m *AuthenticationServiceMock) Update(id, username string) error
- type Config
- type MockAuthGRPCServer
- type MockDialOption
- type RpcOperationFunc
- type Server
- func (s *Server) AuthenticateAccount(ctx context.Context, req *proto.AuthenticateAccountRequest) (*proto.AuthenticateAccountResponse, error)
- func (s *Server) CheckJwtTokenForInValidity(ctx context.Context, result interface{}, operation string) (error, bool, string)
- func (s *Server) ConfigureAndStartRootSpan(ctx context.Context, operationType string) (context.Context, opentracing.Span)
- func (s *Server) CreateAccount(ctx context.Context, req *proto.CreateAccountRequest) (*proto.CreateAccountResponse, error)
- func (s *Server) DeleteAccount(ctx context.Context, req *proto.DeleteAccountRequest) (*proto.DeleteAccountResponse, error)
- func (s *Server) GetAccount(ctx context.Context, req *proto.GetAccountRequest) (*proto.GetAccountResponse, error)
- func (s *Server) GetAccountFromResponseObject(ctx context.Context, ok bool, result interface{}, operation string) (*core_auth_sdk.Account, error)
- func (s *Server) GetIdFromResponseObject(ctx context.Context, response interface{}, operationType string) (int, error)
- func (s *Server) IsPasswordOrEmailInValid(email string, password string, operationType string) (error, bool)
- func (s *Server) IsValidEmail(email string, operationType string) (error, bool)
- func (s *Server) IsValidID(Id uint32, operation string) (error, bool)
- func (s *Server) IsValidPassword(password string, operationType string) (error, bool)
- func (s *Server) ListenAndServe()
- func (s *Server) LockAccount(ctx context.Context, req *proto.LockAccountRequest) (*proto.LockAccountResponse, error)
- func (s *Server) LogoutAccount(ctx context.Context, req *proto.LogoutAccountRequest) (*proto.LogoutAccountResponse, error)
- func (s *Server) PerformRetryableRPCOperation(ctx context.Context, span opentracing.Span, op proto.DownStreamOperation, ...) proto.DownStreamOperation
- func (s *Server) StartRootSpan(ctx context.Context, operationType string) (context.Context, opentracing.Span)
- func (s *Server) UnLockAccount(ctx context.Context, req *proto.UnLockAccountRequest) (*proto.UnLockAccountResponse, error)
- func (s *Server) UpdateAccount(ctx context.Context, req *proto.UpdateAccountRequest) (*proto.UpdateAccountResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ThirdPartyMockService = AuthenticationServiceMock{}
Functions ¶
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
Types ¶
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 (m *AuthenticationServiceMock) GetAccount(id string) (*core_auth_sdk.Account, error)
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 MockAuthGRPCServer ¶
type MockAuthGRPCServer struct {
proto.UnimplementedAuthenticationHandlerServiceApiServer
}
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 ¶
func (s *Server) AuthenticateAccount(ctx context.Context, req *proto.AuthenticateAccountRequest) (*proto.AuthenticateAccountResponse, error)
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 ¶
func (s *Server) CreateAccount(ctx context.Context, req *proto.CreateAccountRequest) (*proto.CreateAccountResponse, error)
CreateAccount creates a user account via the authentication service
func (*Server) DeleteAccount ¶
func (s *Server) DeleteAccount(ctx context.Context, req *proto.DeleteAccountRequest) (*proto.DeleteAccountResponse, error)
DeleteAccount deletes a user account via the authentication service
func (*Server) GetAccount ¶
func (s *Server) GetAccount(ctx context.Context, req *proto.GetAccountRequest) (*proto.GetAccountResponse, error)
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 ¶
IsValidEmail checks if an email is valid.
func (*Server) IsValidID ¶
IsValidID checks that the ID passed as part of the request parameters is indeed valid.
func (*Server) IsValidPassword ¶
IsValidPassword checks if a password if valid;
func (*Server) ListenAndServe ¶
func (s *Server) ListenAndServe()
ListenAndServe starts the grpc service
func (*Server) LockAccount ¶
func (s *Server) LockAccount(ctx context.Context, req *proto.LockAccountRequest) (*proto.LockAccountResponse, error)
LockAccount locks an account as long as it exists from the context of the authentication service
func (*Server) LogoutAccount ¶
func (s *Server) LogoutAccount(ctx context.Context, req *proto.LogoutAccountRequest) (*proto.LogoutAccountResponse, error)
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 ¶
func (s *Server) UnLockAccount(ctx context.Context, req *proto.UnLockAccountRequest) (*proto.UnLockAccountResponse, error)
UnLockAccount unlocks a user account from the context of the authentication service as long as the account exists
func (*Server) UpdateAccount ¶
func (s *Server) UpdateAccount(ctx context.Context, req *proto.UpdateAccountRequest) (*proto.UpdateAccountResponse, error)
UpdateAccount updates the account via the authentication services