Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NeedsAuth ¶
func NeedsAuth(devmode bool, backend storage.Backend, operator ops.Operator, authenticator users.Authenticator, usersService users.Identity, fn ServiceHandle) httprouter.Handle
NeedsAuth is authentication wrapper for ops handlers
Types ¶
type HandlerContext ¶
type HandlerContext struct { // Operator is the operator service Operator ops.Operator // SiteKey is the request cluster key SiteKey ops.SiteKey // User is the authenticated user User storage.User // Identity is the users service Identity users.Identity // Checker is used for ACL checks Checker teleservices.AccessChecker // Context is the request context Context context.Context }
HandlerContext is the request context that gets passed into each handler function
func GetHandlerContext ¶
func GetHandlerContext(w http.ResponseWriter, r *http.Request, backend storage.Backend, operator ops.Operator, authenticator users.Authenticator, usersService users.Identity) (*HandlerContext, error)
GetHandlerContext authenticates the user that made the request and returns the appropriate handler context
type ServiceHandle ¶
type ServiceHandle func(http.ResponseWriter, *http.Request, httprouter.Params, *HandlerContext) error
ServiceHandle defines an ops handler function type
type WebHandler ¶
type WebHandler struct { httprouter.Router // contains filtered or unexported fields }
func NewWebHandler ¶
func NewWebHandler(cfg WebHandlerConfig) (*WebHandler, error)
func (*WebHandler) GetConfig ¶
func (h *WebHandler) GetConfig() WebHandlerConfig
GetConfig returns config web handler was initialized with
func (*WebHandler) ServeHTTP ¶
func (h *WebHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP lets the authentication middleware serve the request before passing it through to the router.
type WebHandlerConfig ¶
type WebHandlerConfig struct { // Backend is the process backend Backend storage.Backend // Users is the process users service Users users.Identity // Operator is the underlying ops service Operator ops.Operator // Applications is the apps service Applications app.Applications // Packages is the pack service Packages pack.PackageService // Authenticator is used to authenticate web requests Authenticator users.Authenticator // Devmode is whether the process is started in dev mode Devmode bool // PublicAdvertiseAddr is the process public advertise address PublicAdvertiseAddr teleutils.NetAddr }
WebHandlerConfig is the ops web handler configuration
func (*WebHandlerConfig) CheckAndSetDefaults ¶
func (c *WebHandlerConfig) CheckAndSetDefaults() error
CheckAndSetDefaults validates the config and sets some defaults.
Click to show internal directories.
Click to hide internal directories.