// VerifySecret verifies the UI_SECRET cookie in a http request. func VerifySecret(r *http.Request) bool { secret := config.UISecret() c, err := r.Cookie("uisecret") if err != nil { log.Warningf("Failed to get secret cookie, error: %v", err) } return c != nil && c.Value == secret }
func addAuthentication(req *http.Request) { if req != nil { req.AddCookie(&http.Cookie{ Name: models.UISecretCookie, Value: config.UISecret(), }) } }