Documentation
¶
Index ¶
- Constants
- Variables
- func AddDefaultResponseHeaders() macaron.Handler
- func AddRenderAuthKey(orgId int64, userId int64, orgRole m.RoleType) string
- func AdminOrFeatureEnabled(enabled bool) macaron.Handler
- func Auth(options *AuthOptions) macaron.Handler
- func EnsureEditorOrViewerCanEdit(c *m.ReqContext)
- func GetContextHandler(ats m.UserTokenService) macaron.Handler
- func Gziper() macaron.Handler
- func HandleNoCacheHeader() macaron.Handler
- func Logger() macaron.Handler
- func MeasureRequestTime() macaron.Handler
- func OrgRedirect() macaron.Handler
- func Quota(quotaService *quota.QuotaService) func(target string) macaron.Handler
- func Recovery() macaron.Handler
- func RedirectFromLegacyDashboardSoloURL() macaron.Handler
- func RedirectFromLegacyDashboardURL() macaron.Handler
- func RemoveRenderAuthKey(key string)
- func RequestMetrics(handler string) macaron.Handler
- func RequestTracing(handler string) macaron.Handler
- func RoleAuth(roles ...m.RoleType) macaron.Handler
- func ValidateHostHeader(domain string) macaron.Handler
- func WriteSessionCookie(ctx *m.ReqContext, value string, maxLifetimeDays int)
- type AuthOptions
Constants ¶
View Source
const HeaderNameNoBackendCache = "X-Grafana-NoCache"
Variables ¶
View Source
var ( ReqGrafanaAdmin = Auth(&AuthOptions{ReqSignedIn: true, ReqGrafanaAdmin: true}) ReqSignedIn = Auth(&AuthOptions{ReqSignedIn: true}) ReqEditorRole = RoleAuth(m.ROLE_EDITOR, m.ROLE_ADMIN) ReqOrgAdmin = RoleAuth(m.ROLE_ADMIN) )
View Source
var (
AUTH_PROXY_SESSION_VAR = "authProxyHeaderValue"
)
Functions ¶
func AdminOrFeatureEnabled ¶
AdminOrFeatureEnabled creates a middleware that allows access if the signed in user is either an Org Admin or if the feature flag is enabled. Intended for when feature flags open up access to APIs that are otherwise only available to admins.
func Auth ¶
func Auth(options *AuthOptions) macaron.Handler
func EnsureEditorOrViewerCanEdit ¶
func EnsureEditorOrViewerCanEdit(c *m.ReqContext)
func GetContextHandler ¶
func GetContextHandler(ats m.UserTokenService) macaron.Handler
func HandleNoCacheHeader ¶
func MeasureRequestTime ¶
func OrgRedirect ¶
func Quota ¶
func Quota(quotaService *quota.QuotaService) func(target string) macaron.Handler
Quota returns a function that returns a function used to call quotaservice based on target name
func Recovery ¶
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one. While Martini is in development mode, Recovery will also output the panic as HTML.
func RemoveRenderAuthKey ¶
func RemoveRenderAuthKey(key string)
func RequestMetrics ¶
func RequestTracing ¶
func ValidateHostHeader ¶
func WriteSessionCookie ¶
func WriteSessionCookie(ctx *m.ReqContext, value string, maxLifetimeDays int)
Types ¶
type AuthOptions ¶
Click to show internal directories.
Click to hide internal directories.