Documentation ¶
Overview ¶
Package contexthandler contains the ContextHandler service.
Index ¶
Constants ¶
View Source
const ( InvalidJWT = "Invalid JWT" InvalidRole = "Invalid Role" UserNotFound = "User not found" )
View Source
const ( InvalidUsernamePassword = "invalid username or password" /* #nosec */ InvalidAPIKey = "invalid API key" )
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
func FromContext(c context.Context) *contextmodel.ReqContext
FromContext returns the ReqContext value stored in a context.Context, if any.
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 auth.UserTokenService JWTAuthService auth.JWTVerifierService RemoteCache *remotecache.RemoteCache RenderService rendering.Service SQLStore db.DB // 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 auth.UserTokenService, jwtService jwt.JWTService, remoteCache *remotecache.RemoteCache, renderService rendering.Service, sqlStore db.DB, tracer tracing.Tracer, authProxy *authproxy.AuthProxy, loginService login.Service, apiKeyService apikey.Service, authenticator loginpkg.Authenticator, userService user.Service, orgService org.Service, oauthTokenService oauthtoken.OAuthTokenService, features *featuremgmt.FeatureManager, authnService authn.Service, anonSessionService anonymous.Service, ) *ContextHandler
func (*ContextHandler) Middleware ¶
func (h *ContextHandler) Middleware(next http.Handler) http.Handler
Middleware provides a middleware to initialize the request context.
Click to show internal directories.
Click to hide internal directories.