server

package
v3.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuthRoutes

func RegisterAuthRoutes(oidc *iam.OIDC, mux *AuthMux) error

RegisterAuthRoutes registers the OAuth2 authentication routes

func SetOriginHeader

func SetOriginHeader(h http.Handler) http.Handler

SetOriginHeader is middleware that copies the Origin header from the request to the response This is necessary when using AllowAllOrigins because the browser will complain if the response header is the "*" and not the same origin as on the request. The cors handler in the connect library doesn't do this by default.

Types

type AuthMux

type AuthMux struct {
	// contains filtered or unexported fields
}

AuthMux wraps http.ServeMux to add protected route handling

func NewAuthMux

func NewAuthMux(serverConfig *config.AssistantServerConfig, oidc *iam.OIDC) (*AuthMux, error)

NewAuthMux creates a new AuthMux

func (*AuthMux) Handle

func (p *AuthMux) Handle(pattern string, handler http.Handler)

Handle registers a handler for the given pattern

func (*AuthMux) HandleFunc

func (p *AuthMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

HandleFunc registers a handler function for the given pattern

func (*AuthMux) HandleProtected

func (p *AuthMux) HandleProtected(pattern string, handler http.Handler, checker iam.Checker, role string)

HandleProtected registers a protected handler for the given pattern

func (*AuthMux) HandleProtectedFunc

func (p *AuthMux) HandleProtectedFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

HandleProtectedFunc registers a protected handler function for the given pattern

func (*AuthMux) ServeHTTP

func (p *AuthMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

type Options

type Options struct {
	Telemetry *config.TelemetryConfig
	Server    *config.AssistantServerConfig
	WebApp    *agentv1.WebAppConfig
	IAMPolicy *api.IAMPolicy
	// RegisterHandlers is a callback that allows you to register additional handlers in the server.
	// These could be regular HTTP handlers or proto services.
	RegisterHandlers RegisterHandlers
}

type RegisterHandlers added in v3.15.1

type RegisterHandlers func(mux *AuthMux, checker iam.Checker, interceptors []connect.Interceptor) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the main server for the cloud assistant

func NewServer

func NewServer(opts Options, agent agentv1connect.MessagesServiceHandler) (*Server, error)

NewServer creates a new server

func (*Server) Run

func (s *Server) Run() error

Run starts the http server Cells until its shutdown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL