service

package
v0.0.0-...-070f372 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoginNotAuthorized = status.Error(codes.Unauthenticated, "Login credentials not authorized")

ErrLoginNotAuthorized is returned from LoginHandler if invalid credentials are presented.

Functions

func Authenticated

func Authenticated(ctx context.Context) bool

func SetAuthenticated

func SetAuthenticated(ctx context.Context, auth bool) context.Context

Types

type AuthHandler

type AuthHandler func(jwt string) error

AuthHandler is a function to handle authorization. The service will extract a jwt token from the bearer header and pass it to AuthHandler. AuthHandler returns nil if authorized, otherwise an error.

type LoginHandler

type LoginHandler func(user, password string) (jwtToken string, err error)

LoginHandler takes a user name and password and returns a jwt token that the client will use in subsequent requests. LogHandler returns ErrNotAuthorized if authorization fails. Other errors maybe returned for server side problems.

type TimeseriesService

type TimeseriesService interface {
	Search(context.Context, *api.SearchRequest) (*api.SearchResponse, error)
	Login(context.Context, *api.LoginRequest) (*api.LoginResponse, error)
}

TimeseriesService defines endpoint for grpc calls.

func New

func New(logger log.Logger, searcher storage.Searcher, hLogin LoginHandler) TimeseriesService

Directories

Path Synopsis
Package storage handles in memory storage and searching for time series elements.
Package storage handles in memory storage and searching for time series elements.
Package subscriber handles incoming messages from Kafka.
Package subscriber handles incoming messages from Kafka.

Jump to

Keyboard shortcuts

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