This commit is contained in:
Torkel Ödegaard
2014-09-17 09:49:28 +02:00
parent 31fe471da5
commit 2380a26987
5 changed files with 24 additions and 7 deletions
+11
View File
@@ -51,6 +51,17 @@ func (self *HttpServer) logoutPost(c *gin.Context) {
c.JSON(200, gin.H{"status": "logged out"})
}
type GrafanaReqContext struct {
}
type authenticatedAuthRouteFunc func(c *gin.Context, grc GrafanaReqContext)
func (self *HttpServer) addAuthRoute(route string, handler authenticatedAuthRouteFunc) {
self.router.GET(route, self.auth(), func(c *gin.Context) {
})
}
func (self *HttpServer) auth() gin.HandlerFunc {
return func(c *gin.Context) {
session, _ := sessionStore.Get(c.Request, "grafana-session")