aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middleware/context_keys.go
blob: c011fbb6b767c85a42b642c0f863804e08822038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

package middleware

type contextKey struct {
	name string
}

var (
	// UserIDContextKey is the context key used to store the user ID.
	UserIDContextKey = &contextKey{"UserID"}

	// UserTimezoneContextKey is the context key used to store the user timezone.
	UserTimezoneContextKey = &contextKey{"UserTimezone"}

	// IsAdminUserContextKey is the context key used to store the user role.
	IsAdminUserContextKey = &contextKey{"IsAdminUser"}

	// IsAuthenticatedContextKey is the context key used to store the authentication flag.
	IsAuthenticatedContextKey = &contextKey{"IsAuthenticated"}

	// CsrfContextKey is the context key used to store CSRF token.
	CsrfContextKey = &contextKey{"CSRF"}
)