Documentation
¶
Overview ¶
Package usercontext carries the authenticated subject through a request context.
It lives outside the auth package so that layers auth itself depends on - services, typically - can still read who is performing an action without creating an import cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetUserContext ¶
func SetUserContext(ctx context.Context, userCtx *UserContext) context.Context
SetUserContext adds a UserContext to the given context.
Types ¶
type UserContext ¶
type UserContext struct {
UserID int64
Username string
SubjectPermissions *model.SubjectPermissions
AuthType types.AuthType
}
func GetUser ¶
func GetUser(ctx context.Context) *UserContext
func (UserContext) GetUserIdStr ¶
func (uc UserContext) GetUserIdStr() string
func (UserContext) IsUser ¶
func (uc UserContext) IsUser() bool
IsUser reports whether the subject is a real user account. API tokens authenticate without one and carry the token name instead.
Click to show internal directories.
Click to hide internal directories.