contexthandler

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package contexthandler contains the ContextHandler service.

Index

Constants

View Source
const (
	InvalidUsernamePassword = "invalid username or password"
	// False positive.
	//nolint:gosec
	InvalidAPIKey = "invalid API key"
)
View Source
const InvalidJWT = "Invalid JWT"
View Source
const ServiceName = "ContextHandler"
View Source
const UserNotFound = "User not found"

Variables

This section is empty.

Functions

func FromContext

func FromContext(c context.Context) *models.ReqContext

FromContext returns the ReqContext value stored in a context.Context, if any.

func WithAuthHTTPHeader

func WithAuthHTTPHeader(parent context.Context, name string) context.Context

WithAuthHTTPHeader returns a copy of parent in which the named HTTP header will be included and later retrievable by AuthHTTPHeaderListFromContext.

Types

type AuthHTTPHeaderList

type AuthHTTPHeaderList struct {
	Items []string
}

AuthHTTPHeaderList used to record HTTP headers that being when verifying authentication of an incoming HTTP request.

func AuthHTTPHeaderListFromContext

func AuthHTTPHeaderListFromContext(c context.Context) *AuthHTTPHeaderList

AuthHTTPHeaderListFromContext returns the AuthHTTPHeaderList in a context.Context, if any, and will include any HTTP headers used when verifying authentication of an incoming HTTP request.

type ContextHandler

type ContextHandler struct {
	Cfg              *setting.Cfg
	AuthTokenService models.UserTokenService
	JWTAuthService   models.JWTService
	RemoteCache      *remotecache.RemoteCache
	RenderService    rendering.Service
	SQLStore         sqlstore.Store

	// GetTime returns the current time.
	// Stubbable by tests.
	GetTime func() time.Time
	// contains filtered or unexported fields
}

ContextHandler is a middleware.

func ProvideService

func ProvideService(cfg *setting.Cfg, tokenService models.UserTokenService, jwtService models.JWTService,
	remoteCache *remotecache.RemoteCache, renderService rendering.Service, sqlStore sqlstore.Store,
	tracer tracing.Tracer, authProxy *authproxy.AuthProxy, loginService login.Service, authenticator loginpkg.Authenticator) *ContextHandler

func (*ContextHandler) Middleware

func (h *ContextHandler) Middleware(mContext *web.Context)

Middleware provides a middleware to initialize the Macaron context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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