miniflux/middleware/context_keys.go

53 lines
1.9 KiB
Go
Raw Normal View History

2018-04-28 05:38:46 +02:00
// Copyright 2018 Frédéric Guillot. All rights reserved.
2017-11-28 06:30:04 +01:00
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package middleware
2017-12-17 03:07:53 +01:00
// ContextKey represents a context key.
type ContextKey struct {
2017-11-28 06:30:04 +01:00
name string
}
2017-12-17 03:07:53 +01:00
func (c ContextKey) String() string {
return c.name
}
2017-11-28 06:30:04 +01:00
var (
// UserIDContextKey is the context key used to store the user ID.
2017-12-17 03:07:53 +01:00
UserIDContextKey = &ContextKey{"UserID"}
2017-11-28 06:30:04 +01:00
// UserTimezoneContextKey is the context key used to store the user timezone.
2017-12-17 03:07:53 +01:00
UserTimezoneContextKey = &ContextKey{"UserTimezone"}
2017-11-28 06:30:04 +01:00
// IsAdminUserContextKey is the context key used to store the user role.
2017-12-17 03:07:53 +01:00
IsAdminUserContextKey = &ContextKey{"IsAdminUser"}
2017-11-28 06:30:04 +01:00
// IsAuthenticatedContextKey is the context key used to store the authentication flag.
2017-12-17 03:07:53 +01:00
IsAuthenticatedContextKey = &ContextKey{"IsAuthenticated"}
// UserSessionTokenContextKey is the context key used to store the user session ID.
UserSessionTokenContextKey = &ContextKey{"UserSessionToken"}
// UserLanguageContextKey is the context key to store user language.
UserLanguageContextKey = &ContextKey{"UserLanguageContextKey"}
2017-12-17 03:07:53 +01:00
// SessionIDContextKey is the context key used to store the session ID.
SessionIDContextKey = &ContextKey{"SessionID"}
// CSRFContextKey is the context key used to store CSRF token.
CSRFContextKey = &ContextKey{"CSRF"}
// OAuth2StateContextKey is the context key used to store OAuth2 state.
OAuth2StateContextKey = &ContextKey{"OAuth2State"}
// FlashMessageContextKey is the context key used to store a flash message.
FlashMessageContextKey = &ContextKey{"FlashMessage"}
2017-11-28 06:30:04 +01:00
2017-12-17 03:07:53 +01:00
// FlashErrorMessageContextKey is the context key used to store a flash error message.
FlashErrorMessageContextKey = &ContextKey{"FlashErrorMessage"}
// PocketRequestTokenContextKey is the context key for Pocket Request Token.
PocketRequestTokenContextKey = &ContextKey{"PocketRequestToken"}
2017-11-28 06:30:04 +01:00
)