aboutsummaryrefslogtreecommitdiff
path: root/server/middleware/context_keys.go
blob: 3099322ad67b0a108a34973799b2002a3c9a4d98 (plain) (blame)
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"}

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