Documentation
¶
Overview ¶
Package wardenhook bridges Keysmith key lifecycle events to Warden authorization. It defines a local WardenBridge interface so the package does not import Warden directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension bridges Keysmith key lifecycle events to Warden authorization. When a key is created with scopes, it syncs those scopes as Warden permissions and optionally assigns a Warden role to the API key subject.
func New ¶
func New(bridge WardenBridge, opts ...Option) *Extension
New creates a Warden bridge extension.
func (*Extension) OnKeyCreated ¶
OnKeyCreated implements plugin.KeyCreated. Syncs key scopes to Warden permissions and optionally assigns a role.
type Option ¶
type Option func(*Extension)
Option is a functional option for the Warden bridge extension.
func WithAutoAssign ¶
WithAutoAssign controls whether a Warden role is auto-assigned on key creation.
func WithDefaultRole ¶
WithDefaultRole sets the default Warden role slug for API keys.
type WardenBridge ¶
type WardenBridge interface {
// AssignRoleToAPIKey assigns a Warden role to an API key subject.
AssignRoleToAPIKey(ctx context.Context, tenantID, keyID, roleSlug string) error
// UnassignRoleFromAPIKey removes a Warden role from an API key subject.
UnassignRoleFromAPIKey(ctx context.Context, tenantID, keyID string) error
// SyncScopesToPermissions ensures Warden permissions exist for the given scopes.
SyncScopesToPermissions(ctx context.Context, tenantID string, scopes []string) error
}
WardenBridge is the interface Warden must satisfy for Keysmith to sync scope-based role assignments. Defined locally to avoid importing Warden.