Documentation
¶
Index ¶
- type ClientInfo
- type GrantInfo
- type RequestInfo
- type Store
- func (s *Store) ApproveRequest(requestID int64, approvedBy string) error
- func (s *Store) Close() error
- func (s *Store) CreateRequest(clientID string, methods []string) (int64, error)
- func (s *Store) DenyRequest(requestID int64) error
- func (s *Store) Grant(clientID string, methodPattern string, grantedBy string) error
- func (s *Store) IsMethodAllowed(clientID string, fullMethod string) (bool, error)
- func (s *Store) ListClients() ([]ClientInfo, error)
- func (s *Store) ListGrants(clientID string) ([]GrantInfo, error)
- func (s *Store) ListPendingRequests() ([]RequestInfo, error)
- func (s *Store) RegisterClient(clientID string, certPEM string, fingerprint string) error
- func (s *Store) Revoke(clientID string, methodPattern string) error
- func (s *Store) RevokeClient(clientID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfo ¶
ClientInfo describes a registered client.
type RequestInfo ¶
type RequestInfo struct {
ID int64
ClientID string
Methods []string
RequestedAt time.Time
Status string
}
RequestInfo describes a pending (or resolved) access request.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides SQLite-backed storage for per-method ACL grants, client registrations, and pending access requests.
func OpenStore ¶
OpenStore opens (or creates) a SQLite database at dbPath and ensures the required tables exist.
func (*Store) ApproveRequest ¶
ApproveRequest marks the request as 'approved' and creates grants for each method in the request. Both operations run in a single transaction.
func (*Store) CreateRequest ¶
CreateRequest stores a new pending access request. The methods slice is serialized as a JSON array. Returns the request row ID.
func (*Store) DenyRequest ¶
DenyRequest marks the request as 'denied' without creating any grants.
func (*Store) Grant ¶
Grant inserts an access grant for the given client and method pattern. If the exact (clientID, methodPattern) pair already exists, the call is silently ignored (INSERT OR IGNORE).
func (*Store) IsMethodAllowed ¶
IsMethodAllowed checks whether any grant for the given client matches the full gRPC method name. Matching rules:
- Exact match: pattern equals fullMethod
- Service wildcard: "/service.Name/*" matches any method in that service
- Global wildcard: "/*" matches everything
Uses path.Match for glob matching.
func (*Store) ListClients ¶
func (s *Store) ListClients() ([]ClientInfo, error)
ListClients returns all registered clients.
func (*Store) ListGrants ¶
ListGrants returns grants for the given client. If clientID is empty, all grants are returned.
func (*Store) ListPendingRequests ¶
func (s *Store) ListPendingRequests() ([]RequestInfo, error)
ListPendingRequests returns all requests with status='pending'.
func (*Store) RegisterClient ¶
RegisterClient inserts a new client record.
func (*Store) RevokeClient ¶
RevokeClient deletes the client record and all associated grants. Both operations run in a single transaction.