Documentation
¶
Index ¶
- type BFFAuthCookie
- type BFFCookie
- type Handler
- type Option
- func WithAuthStore(store auth.Store) Option
- func WithBFFAuthCookie(c *BFFAuthCookie) Option
- func WithBFFAuthCookieUseTopDomain(v bool) Option
- func WithBFFCookieSession(c *BFFCookie) Option
- func WithBFFCookieUseTopDomain(v bool) Option
- func WithCORSAllowCredentials(v bool) Option
- func WithCORSAllowedOrigins(origins []string) Option
- func WithCleanupInterval(d time.Duration) Option
- func WithIdleTTL(d time.Duration) Option
- func WithKeepAliveInterval(d time.Duration) Option
- func WithLogoutAllPath(path string) Option
- func WithMaxEventBuffer(n int) Option
- func WithMaxLifetime(d time.Duration) Option
- func WithMessageURI(messageURI string) Option
- func WithOnSessionClose(fn func(*base.Session)) Option
- func WithOverflowPolicy(p base.OverflowPolicy) Option
- func WithReconnectGrace(d time.Duration) Option
- func WithRehydrateOnHandshake(v bool) Option
- func WithRemovalPolicy(p base.RemovalPolicy) Option
- func WithSessionStore(store base.SessionStore) Option
- func WithSseSessionLocation(location *session.Location) Option
- func WithStreamingSessionLocation(location *session.Location) Option
- func WithURI(sseURI string) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BFFAuthCookie ¶ added in v0.15.0
type BFFAuthCookie struct {
Name string
Path string
Domain string
Secure bool
HttpOnly bool
SameSite http.SameSite
MaxAge int
}
BFFAuthCookie defines cookie attributes used for the BFF auth session id (opaque grant id).
type BFFCookie ¶ added in v0.15.0
type BFFCookie struct {
Name string
Path string
Domain string
Secure bool
HttpOnly bool
SameSite http.SameSite
MaxAge int
}
BFFCookie defines cookie attributes used to carry the session id.
type Handler ¶
type Handler struct {
Options
// contains filtered or unexported fields
}
Handler represents a server-side newNandler for SSE and message transport.
type Option ¶
type Option func(t *Options)
func WithAuthStore ¶ added in v0.15.0
WithAuthStore configures the durable store for BFF auth grants.
func WithBFFAuthCookie ¶ added in v0.15.0
func WithBFFAuthCookie(c *BFFAuthCookie) Option
WithBFFAuthCookie configures the cookie used to carry the BFF auth grant id.
func WithBFFAuthCookieUseTopDomain ¶ added in v0.15.0
WithBFFAuthCookieUseTopDomain enables auto Domain=eTLD+1 for the auth cookie when Domain is empty.
func WithBFFCookieSession ¶ added in v0.15.0
WithBFFCookieSession enables cookie-based session id for BFF deployments.
func WithBFFCookieUseTopDomain ¶ added in v0.15.0
WithBFFCookieUseTopDomain enables auto setting cookie Domain to eTLD+1 derived from request host.
func WithCORSAllowCredentials ¶ added in v0.15.0
WithCORSAllowCredentials toggles Access-Control-Allow-Credentials and credentialed requests.
func WithCORSAllowedOrigins ¶ added in v0.15.0
WithCORSAllowedOrigins sets the allowed origins for CORS (must not be "*" when AllowCredentials is true).
func WithCleanupInterval ¶ added in v0.15.0
WithCleanupInterval sets how often the cleanup sweeper runs.
func WithIdleTTL ¶ added in v0.15.0
WithIdleTTL sets the idle timeout for sessions.
func WithKeepAliveInterval ¶ added in v0.16.2
WithKeepAliveInterval sets the interval for SSE keepalive frames on the GET stream. Set to 0 or negative to disable.
func WithLogoutAllPath ¶ added in v0.15.0
WithLogoutAllPath sets an optional path to revoke the BFF auth grant (logout all sessions).
func WithMaxEventBuffer ¶ added in v0.15.0
WithMaxEventBuffer sets the default event buffer size used for resumability.
func WithMaxLifetime ¶ added in v0.15.0
WithMaxLifetime sets the hard cap on session lifetime.
func WithMessageURI ¶
WithMessageURI sets the message URI for the transport
func WithOnSessionClose ¶ added in v0.15.0
WithOnSessionClose registers a hook invoked when a session is finally closed.
func WithOverflowPolicy ¶ added in v0.15.0
func WithOverflowPolicy(p base.OverflowPolicy) Option
WithOverflowPolicy sets the event buffer overflow policy.
func WithReconnectGrace ¶ added in v0.15.0
WithReconnectGrace sets the grace period during which a detached session is kept for reconnection.
func WithRehydrateOnHandshake ¶ added in v0.15.0
WithRehydrateOnHandshake toggles using the auth cookie to mint a new MCP session when no session id is provided.
func WithRemovalPolicy ¶ added in v0.15.0
func WithRemovalPolicy(p base.RemovalPolicy) Option
WithRemovalPolicy sets the session removal policy.
func WithSessionStore ¶ added in v0.15.0
func WithSessionStore(store base.SessionStore) Option
WithSessionStore injects a custom SessionStore implementation.
func WithSseSessionLocation ¶ added in v0.5.1
WithSseSessionLocation sets the optional sessionIdLocation for the transport, used for constructing full URIs
func WithStreamingSessionLocation ¶ added in v0.5.1
WithStreamingSessionLocation sets the optional sessionIdLocation for the transport, used for constructing full URIs
type Options ¶ added in v0.5.3
type Options struct {
MessageURI string
URI string
SessionLocation *session.Location // Optional sessionIdLocation for the transport, used for constructing full URIs
StreamingSessionLocation *session.Location // Optional sessionIdLocation for the transport, used for constructing full URIs
// Lifecycle controls
ReconnectGrace time.Duration
IdleTTL time.Duration
MaxLifetime time.Duration
CleanupInterval time.Duration
MaxEventBuffer int
OnSessionClose func(*base.Session)
RemovalPolicy base.RemovalPolicy
OverflowPolicy base.OverflowPolicy
// Optional custom session store (e.g., Redis-backed). Defaults to in-memory.
Store base.SessionStore
// BFF cookie-based session id (optional, disabled by default)
CookieSession *BFFCookie
// CORS settings for browsers
AllowedOrigins []string
AllowCredentials bool
// If true and CookieSession.Domain is empty, set cookie Domain to the request's top domain (eTLD+1).
CookieUseTopDomain bool
// BFF auth (server-held) grant
AuthStore auth.Store
AuthCookie *BFFAuthCookie
AuthCookieUseTopDomain bool
RehydrateOnHandshake bool
LogoutAllPath string
// KeepAliveInterval controls emission of SSE keepalive frames on the
// long-lived GET stream. Zero or negative disables keepalives.
KeepAliveInterval time.Duration
}
Options represents SSE options