options

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option represnets a option for making middlewares like tracing and reporting middlewares

func WithErrorEncoder

func WithErrorEncoder(errorEncoder kitthttp.ErrorEncoder) Option

WithErrorEncoder sets the errorencoding options for http endpoints

func WithErrorReporting

func WithErrorReporting(reporter errors.Reporter) Option

WithErrorReporting takes a error reporter like sentry or rollbar and adds it as a middleware so the errors that aren't returned to client

func WithGRPCJWTParser

func WithGRPCJWTParser(jwtFunc kittgrpc.ServerRequestFunc, keyFunc stdjwt.Keyfunc, method stdjwt.SigningMethod, cf jwt.ClaimsFactory) Option

WithHTTPJWTParser gets a keyfunc method and claims factory and injects it to the enpoints that require JWT security

func WithHTTPJWTParser

func WithHTTPJWTParser(jwtFunc kitthttp.RequestFunc, keyFunc stdjwt.Keyfunc, method stdjwt.SigningMethod, cf jwt.ClaimsFactory) Option

WithHTTPJWTParser gets a keyfunc method and claims factory and injects it to the enpoints that require JWT security

func WithScopesParser

func WithScopesParser(scopesFunc auth.JWTScopesExtrator) Option

WithScopesParser adds a middleware that injects Scopes in the context see https://godoc.org/github.com/jennyservices/jenny/auth for docs

func WithTracing

func WithTracing(tracer opentracing.Tracer) Option

WithTracing gets a opentracing.Tracer and injects it to every endpoint as a tracing middleware

func WithUserParser

func WithUserParser(userFunc auth.JWTUserExtractor) Option

WithUserParser adds a middleware that injects an object that implents the User interface in the context see https://godoc.org/github.com/jennyservices/jenny/auth for docs

type Options

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

Options represents a set of options that can be passed to Jenny Service Interfaces with the implementation of the interface

func New

func New() *Options

New retunrs new options with defail noop tracer and no op error reporter

func (*Options) GRPCOptions

func (m *Options) GRPCOptions() []kittgrpc.ServerOption

HTTPOptions returns all the server options to be used with HTTP endpoints

func (*Options) HTTPOptions

func (m *Options) HTTPOptions() []kitthttp.ServerOption

HTTPOptions returns all the server options to be used with HTTP endpoints

func (*Options) OpMiddlewares

func (m *Options) OpMiddlewares(operation string) endpoint.Middleware

OpMiddlewares returns the middlewares that were in options Current ordering of the middlewares goes as follows

Request
	↓
Requests-ID (enabled by default)
	↓
Tracing (enabled noop by default)
	↓
Error reporting (enabled noop by default)
	↓
JWT parser (disabled by default, enable by passing WithJWTParser)
	↓
User parser (disabled by default, enable by passing WithUserParser); (this is useful for ratelimiting by user)
	↓
Scopes parser (disabled by default, enable by passing WithScopesParser)

func (*Options) RegisterMiddleware

func (m *Options) RegisterMiddleware(op string, middlewares ...endpoint.Middleware)

RegisterMiddleware pushed the middleware to the middlewareStack, the order in whihc you register the middlewares determines it's execution order, except for middlewares you register withFoo methods.

Jump to

Keyboard shortcuts

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