Documentation
¶
Index ¶
- type Options
- type Server
- func (s *Server) Addr() string
- func (s *Server) Handler() http.Handler
- func (s *Server) RegisterRoute(pattern string, handler http.Handler, roles ...auth.Role)
- func (s *Server) RegisterRouteFunc(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)
- func (s *Server) RegisterRouteFuncAllowQueryToken(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Config config.HTTPConfig
Authorizer *auth.Authorizer
}
Options configure the HTTP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the main API HTTP server with bearer token authentication.
func (*Server) Handler ¶
Handler returns the underlying HTTP handler (ServeMux) used by the server. This is primarily intended for tests that need to exercise the registered routes without starting a real listener.
func (*Server) RegisterRoute ¶
RegisterRoute registers a handler for the given pattern with optional middleware. The authorizer middleware will be applied if roles are provided.
func (*Server) RegisterRouteFunc ¶
func (s *Server) RegisterRouteFunc(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)
RegisterRouteFunc registers a handler function for the given pattern with optional middleware. The authorizer middleware will be applied if roles are provided.
func (*Server) RegisterRouteFuncAllowQueryToken ¶
func (s *Server) RegisterRouteFuncAllowQueryToken(pattern string, handlerFunc http.HandlerFunc, roles ...auth.Role)
RegisterRouteFuncAllowQueryToken registers a handler that also accepts auth_token query parameters for authentication. This is intended for GET endpoints serving downloadable content (logs, diffs, specs) where browser/OSC8 links cannot set Authorization headers.