Documentation
¶
Index ¶
Constants ¶
View Source
const (
Kind = constant.HTTPAuthOPAFilter
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Server mode configuration (recommended for production)
ServerURL string `yaml:"server_url" json:"server_url" mapstructure:"server_url"` // OPA Server address, e.g., http://opa-server:8181
DecisionPath string `yaml:"decision_path" json:"decision_path" mapstructure:"decision_path"` // Decision path, e.g., /v1/data/http/authz/allow
TimeoutMs int `yaml:"timeout_ms" json:"timeout_ms" mapstructure:"timeout_ms"` // Request timeout in milliseconds, default 100
BearerToken string `yaml:"bearer_token" json:"bearer_token" mapstructure:"bearer_token"` // Optional authentication token
// Embedded mode configuration (for backward compatibility)
Policy string `yaml:"policy" json:"policy" mapstructure:"policy"` // Policy content
Entrypoint string `yaml:"entrypoint" json:"entrypoint" mapstructure:"entrypoint"` // Policy entrypoint
}
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func (*Filter) Decode ¶
func (f *Filter) Decode(c *contextHttp.HttpContext) filter.FilterStatus
Decode is the core logic of the filter. It converts HTTP request data into a standard OPA input format and evaluates the policy.
type FilterFactory ¶
type FilterFactory struct {
// contains filtered or unexported fields
}
func (*FilterFactory) Apply ¶
func (factory *FilterFactory) Apply() error
Apply is called after the configuration is loaded and is used to prepare the OPA query.
func (*FilterFactory) Config ¶
func (factory *FilterFactory) Config() any
func (*FilterFactory) PrepareFilterChain ¶
func (factory *FilterFactory) PrepareFilterChain(ctx *contextHttp.HttpContext, chain filter.FilterChain) error
PrepareFilterChain prepares the filter chain for a new request by dynamically creating a Filter
Click to show internal directories.
Click to hide internal directories.