Documentation
¶
Overview ¶
Package authorization provides event authorization services for the ORLY relay. It handles ACL checks, policy evaluation, and access level decisions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACLRegistry ¶
type ACLRegistry interface {
// GetAccessLevel returns the access level for a pubkey and remote address.
GetAccessLevel(pub []byte, address string) string
// CheckPolicy checks if an event passes ACL policy.
CheckPolicy(ev *event.E) (bool, error)
// Active returns the active ACL mode name.
Active() string
}
ACLRegistry abstracts the ACL registry for authorization checks.
type Authorizer ¶
type Authorizer interface {
// Authorize checks if event is allowed based on ACL and policy.
Authorize(ev *event.E, authedPubkey []byte, remote string, eventKind uint16) Decision
}
Authorizer makes authorization decisions for events.
type Config ¶
type Config struct {
AuthRequired bool // Whether auth is required for all operations
AuthToWrite bool // Whether auth is required for write operations
Admins [][]byte // Admin pubkeys
Owners [][]byte // Owner pubkeys
}
Config holds configuration for the authorization service.
type Decision ¶
type Decision struct {
Allowed bool
AccessLevel string // none/read/write/admin/owner/blocked/banned
IsAdmin bool
IsOwner bool
IsPeerRelay bool
SkipACLCheck bool // For admin/owner deletes
DenyReason string // Human-readable reason for denial
RequireAuth bool // Should send AUTH challenge
}
Decision carries authorization context through the event processing pipeline.
func Allow ¶
Allow returns an allowed decision with the given access level.
type PolicyManager ¶
type PolicyManager interface {
// IsEnabled returns whether policy is enabled.
IsEnabled() bool
// CheckPolicy checks if an action is allowed by policy.
CheckPolicy(action string, ev *event.E, pubkey []byte, remote string) (bool, error)
}
PolicyManager abstracts the policy manager for authorization checks.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the Authorizer interface.
func New ¶
func New(cfg *Config, acl ACLRegistry, policy PolicyManager, sync SyncManager) *Service
New creates a new authorization service.
Source Files
¶
- authorization.go
Click to show internal directories.
Click to hide internal directories.