Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultTimeout = 5 * time.Second
DefaultTimeout is the default execution time limit per Lua evaluation.
Variables ¶
View Source
var ErrLuaTimeout = errors.New("lua script exceeded execution time limit")
ErrLuaTimeout is returned when Lua script exceeds execution time limit.
Functions ¶
This section is empty.
Types ¶
type CompiledPolicy ¶
type CompiledPolicy struct {
// contains filtered or unexported fields
}
CompiledPolicy holds a pre-compiled Lua script for reuse across calls.
func Compile ¶
func Compile(script string) (*CompiledPolicy, error)
Compile parses and compiles a Lua script. The result can be reused for many Evaluate calls.
func (*CompiledPolicy) Evaluate ¶
func (cp *CompiledPolicy) Evaluate(claims map[string]any, tokenType string) error
Evaluate runs the compiled Lua policy against the given claims and token type. It returns nil if the script passes, or an error describing the policy violation.
func (*CompiledPolicy) EvaluateWithTimeout ¶
func (cp *CompiledPolicy) EvaluateWithTimeout(claims map[string]any, tokenType string, timeout time.Duration) error
EvaluateWithTimeout runs with a custom execution timeout.
Click to show internal directories.
Click to hide internal directories.