Documentation
¶
Index ¶
Constants ¶
View Source
const (
MiddlewareName = "propagation"
)
Variables ¶
This section is empty.
Functions ¶
func WithLogger ¶ added in v1.3.0
WithLogger sets the logger for the middleware. It uses the runtime's log.WithLogger to ensure consistency.
func WithPropagationType ¶
func WithPropagationType(pt principal.PropagationType) options.Option
WithPropagationType sets the propagation type for the principal.
Types ¶
type Middleware ¶
type Middleware struct {
*Options
// contains filtered or unexported fields
}
Middleware is a Kratos middleware for principal propagation.
func New ¶
func New(opts ...options.Option) *Middleware
New is a convenience function for creating a new principal propagation middleware.
func (*Middleware) Client ¶
func (m *Middleware) Client() middleware.KMiddleware
Client implements the Kratos middleware for client-side principal propagation.
func (*Middleware) Server ¶
func (m *Middleware) Server() middleware.KMiddleware
Server implements the Kratos middleware for server-side principal extraction.
type Options ¶
type Options struct {
// PropagationType determines how the principal is propagated (e.g., via gRPC metadata or HTTP headers).
PropagationType principal.PropagationType
// Logger is the logger instance for the middleware.
Logger log.Logger
}
Options holds the configuration for the principal middleware.
Click to show internal directories.
Click to hide internal directories.