Documentation
¶
Overview ¶
Package directory owns managed identities, administration, and the user and group facts supplied to authorization.
Index ¶
Constants ¶
const DefaultAuditLimit = 100
const MaxAuditLimit = 1000
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuditEvent ¶
type AuditSequence ¶
type AuditSequence uint64
AuditSequence identifies one audit event, independently of directory revisions: several events can belong to the same mutation. Zero starts at the beginning.
type Directory ¶
Directory resolves users within one configured identity provider. LookupUser returns the user and revision from one coherent snapshot. Missing users return nil with a nonempty revision; storage failure is an error, never a missing user.
type Group ¶
type Group struct {
Metadata
ExternalID string
DisplayName string
MemberIDs []string // Stored user IDs, not provider ExternalIDs.
}
Group owns direct user memberships. DisplayName changes affect name selectors; the stable resource ID continues to select the same group.
type GroupSnapshot ¶ added in v0.42.0
type GroupSnapshot struct {
Revision uint64
Groups []GroupSummary
}
GroupSnapshot contains current groups from one coherent revision.
type GroupSummary ¶ added in v0.42.0
type ManagedUser ¶
type ManagedUser struct {
Metadata
ExternalID string
UserName string
Active bool
UserType string
Department string
Organization string
}
ManagedUser contains the identity and attributes used by authorization. Active is explicit at the storage boundary; the HTTP adapter supplies the SCIM default. Group membership is owned by Group, not by the user.
type Metadata ¶
Metadata is assigned by storage. ID identifies the provisioned user or group; it is distinct from the provider's ExternalID used for authentication. Version changes on mutations, including membership cleanup after user deletion.
type Revision ¶
type Revision string
Revision identifies an opaque, coherent directory snapshot. Callers may compare revisions for equality but must not interpret their contents.
type Static ¶
type Static struct {
// contains filtered or unexported fields
}
Static owns directory facts loaded from YAML at startup. Host and realm sections in combined configuration files are accepted but supply no facts. Reloading requires constructing a new directory.
func NewStatic ¶
NewStatic concatenates the user records in paths. IDs are required; duplicate IDs or nonempty user names and unknown fields are load errors. An omitted active field defaults to true. The caller retains ownership of the files.
func (*Static) DirectoryRevision ¶
DirectoryRevision identifies the user records independently of ignored host configuration, preserving the existing static directory snapshot identity.
func (*Static) ListUserFacts ¶
type Store ¶
type Store interface {
Directory
UserLister
CreateUser(context.Context, ManagedUser) (ManagedUser, error)
ReplaceUser(ctx context.Context, id string, user ManagedUser, match string) (ManagedUser, error)
DeleteUser(ctx context.Context, id, match string) error
GetUser(context.Context, string) (ManagedUser, error)
ListUsers(ctx context.Context, start, count int) ([]ManagedUser, int, error)
CreateGroup(context.Context, Group) (Group, error)
ReplaceGroup(ctx context.Context, id string, group Group, match string) (Group, error)
DeleteGroup(ctx context.Context, id, match string) error
GetGroup(context.Context, string) (Group, error)
ListGroups(ctx context.Context, start, count int) ([]Group, int, error)
Groups(context.Context) (GroupSnapshot, error)
// Audit returns at most limit events after the exclusive sequence cursor,
// in sequence order. Zero limit uses DefaultAuditLimit; limits above
// MaxAuditLimit are invalid. An empty result means the cursor is caught up.
Audit(ctx context.Context, after AuditSequence, limit int) ([]AuditEvent, error)
Close() error
}
Store owns directory persistence and all changes to authorization indexes. Each mutation commits the user or group, memberships, audit and revision together. No database handles or multi-call transaction protocol escape here. Get methods return independent snapshots; each List returns a typed slice and total count from one snapshot (start is one-based). LookupUser resolves identity, memberships and current group facts in a single read. Backend failures stay errors.
Replace/Delete accept an optional resource ETag ("*" requires existence). A stale precondition leaves state unchanged.
type User ¶
type UserLister ¶
UserLister supplies administration with all users, including inactive users, and their policy-visible groups from one snapshot. IDs are authentication identities, not provisioning resource IDs. Results are ordered by userName then ID; users and group slices are independent copies, with groups sorted by name. Authorization consumers need only Directory.LookupUser.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package scim adapts SCIM provisioning to the directory storage contract.
|
Package scim adapts SCIM provisioning to the directory storage contract. |
|
Package sqlitestore implements the managed directory using embedded SQLite.
|
Package sqlitestore implements the managed directory using embedded SQLite. |