Documentation ¶
Overview ¶
Package server is for setting up the server.
Index ¶
- func HandleLocalOrOktaWebSocketAuth(omf *okta.MiddlewareFactory) transport.WebsocketInitFunc
- func NewGQLResponseMiddleware() graphql.ResponseMiddleware
- func NewLoggerMiddleware(logger *zap.Logger, environment appconfig.Environment) func(http.Handler) http.Handler
- func NewTraceMiddleware() func(http.Handler) http.Handler
- func TypedErrorList(List *gqlerror.List) []apperrors.ITypedError
- type LambdaConfig
- type OktaClientConfig
- type Server
- func (s Server) NewDBConfig() storage.DBConfig
- func (s Server) NewFlagConfig() flags.Config
- func (s Server) NewLocalAuthIsEnabled() bool
- func (s Server) NewOktaAPIClientCheck()
- func (s Server) NewOktaClientConfig() OktaClientConfig
- func (s Server) NewPrinceLambdaConfig() LambdaConfig
- func (s Server) NewS3Config() upload.Config
- func (s *Server) Serve()
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleLocalOrOktaWebSocketAuth ¶
func HandleLocalOrOktaWebSocketAuth(omf *okta.MiddlewareFactory) transport.WebsocketInitFunc
HandleLocalOrOktaWebSocketAuth is a function that effectively acts as a wrapper around 2 functions that can serve as a transport.WebSocket "InitFunc" This function looks at the initial payload sent when authenticating a websocket connection, and chooses the appropriate authentication middleware to use (in the case of Authorization headers beginning with "Local", it will use package "local"s local.NewLocalWebSocketAuthenticationMiddleware, and in any other case will use package "okta"s NewOktaWebSocketAuthenticationMiddleware)
This function requires the OktaMiddlewareFactory object because it, in some cases (as described above), needs to perform operations that decode JWTs, which is a responsibility of some of the functions attached to that factory. A refactor to clean up this cross-package dependency was considered but determined to be too much effort. (Don't hurt me)
func NewGQLResponseMiddleware ¶
func NewGQLResponseMiddleware() graphql.ResponseMiddleware
NewGQLResponseMiddleware returns a handler with a request based logger
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(logger *zap.Logger, environment appconfig.Environment) func(http.Handler) http.Handler
NewLoggerMiddleware returns a handler with a request based logger
func NewTraceMiddleware ¶
NewTraceMiddleware returns a handler with a trace ID in context
func TypedErrorList ¶
func TypedErrorList(List *gqlerror.List) []apperrors.ITypedError
TypedErrorList casts a list of gqlErrors to Typed Error, so error code can be extracted.
Types ¶
type LambdaConfig ¶
LambdaConfig is the config to call a lambda func
type OktaClientConfig ¶
OktaClientConfig is the okta client configuration
type Server ¶
type Server struct { Config *viper.Viper Worker *worker.Worker // contains filtered or unexported fields }
Server holds dependencies for running the MINT server
func (Server) NewDBConfig ¶
NewDBConfig returns a new DBConfig and check required fields
func (Server) NewFlagConfig ¶
NewFlagConfig checks if Launch Darkly config exists
func (Server) NewLocalAuthIsEnabled ¶
NewLocalAuthIsEnabled returns if local auth is enabled
func (Server) NewOktaAPIClientCheck ¶
func (s Server) NewOktaAPIClientCheck()
NewOktaAPIClientCheck checks if the Okta API client is configured
func (Server) NewOktaClientConfig ¶
func (s Server) NewOktaClientConfig() OktaClientConfig
NewOktaClientConfig returns the okta client config
func (Server) NewPrinceLambdaConfig ¶
func (s Server) NewPrinceLambdaConfig() LambdaConfig
NewPrinceLambdaConfig returns the configutation for the prince lambda
func (Server) NewS3Config ¶
NewS3Config returns a new s3.Config and checks required fields