Documentation ¶
Index ¶
- Variables
- func GetHandlers() map[string]Handler
- func Register(name string, fn Handler)
- func RegisterConfig(name string, config map[string]string)
- func SetContextIdent(ctx context.Context, s Ident)
- func WithContext(ctx context.Context, id Ident) context.Context
- type Config
- type Configs
- type Handler
- type Ident
- type Manager
- type NullUser
- func (m NullUser) GetAspect() string
- func (m NullUser) GetDisplay() string
- func (m NullUser) GetGroups() []string
- func (m NullUser) GetIdentity() string
- func (m NullUser) GetMeta() map[string]string
- func (m NullUser) GetRoles() []string
- func (m NullUser) HasGroup(g ...string) bool
- func (m NullUser) HasRole(r ...string) bool
- func (m NullUser) IsActive() bool
- func (m NullUser) MakeHandlerFunc() func(r *http.Request) Ident
Constants ¶
This section is empty.
Variables ¶
View Source
var Anonymous = NewNullUser("anon", "none", "Guest User", false)
Anonymous is a logged out user
View Source
var ManagerKey = contextKey{"ident.Manger"}
ManagerKey defines the context key for finding the dataloader
Functions ¶
func GetHandlers ¶
GetHandlers get handlers that are registered
func RegisterConfig ¶
RegisterConfig for an ident handler
func SetContextIdent ¶
SetContextIdent writes ident into context
Types ¶
type Config ¶
Config key values to pass to an ident handler
type Configs ¶
Configs configs for each handler
type Handler ¶
Handler handler function to read ident from HTTP request
type Ident ¶
type Ident interface { GetIdentity() string GetAspect() string GetDisplay() string GetGroups() []string GetRoles() []string GetMeta() map[string]string HasRole(r ...string) bool HasGroup(g ...string) bool IsActive() bool }
Ident interface for a logged in user
func GetContextIdent ¶
GetContextIdent returns a user object from session
type Manager ¶
type Manager struct { Ident Ident // contains filtered or unexported fields }
Manager holds a mutex and ident
type NullUser ¶
type NullUser struct { Ident string `json:"ident"` Aspect string `json:"aspect"` Name string `json:"name"` Active bool `json:"active"` }
NullUser implements a null ident
func NewNullUser ¶
NewNullUser creates a null user ident
func (NullUser) HasGroup ¶
HasGroup returns true if matches group
func (NullUser) HasRole ¶
HasRole returns true if matches role
Click to show internal directories.
Click to hide internal directories.