Documentation
¶
Overview ¶
Package scim implements the §6.3.1 SCIM 2.0 receiver. The registry exposes /scim/v2/Users and /scim/v2/Groups so an OIDC IdP (Okta, Entra ID, Workspace, Auth0, Keycloak) can push user and group memberships into the registry. The visibility evaluator queries scim_memberships when a layer config references a group that exists in the SCIM table.
SCIM scope shipped here:
- Users: id, externalId, userName, emails, active.
- Groups: id, displayName, members.
- Filter expressions: eq, sw, co on userName / displayName.
- Bearer token auth via PODIUM_SCIM_TOKEN.
Operations not shipped (return SCIM-conformant errors):
- PATCH operations beyond simple add/remove members and toggle active. Most IdPs use full PUT to be safe.
- Bulk endpoint (/Bulk).
- Schemas / ServiceProviderConfig discovery beyond the minimum the IdP needs to validate the endpoint.
Index ¶
- Variables
- type FileStore
- func (f *FileStore) CreateGroup(ctx context.Context, g Group) (Group, error)
- func (f *FileStore) CreateUser(ctx context.Context, u User) (User, error)
- func (f *FileStore) DeleteGroup(ctx context.Context, id string) error
- func (f *FileStore) DeleteUser(ctx context.Context, id string) error
- func (f *FileStore) GetGroup(ctx context.Context, id string) (Group, error)
- func (f *FileStore) GetUser(ctx context.Context, id string) (User, error)
- func (f *FileStore) ListGroups(ctx context.Context, filter Filter) ([]Group, error)
- func (f *FileStore) ListUsers(ctx context.Context, filter Filter) ([]User, error)
- func (f *FileStore) MembersOf(ctx context.Context, groupName string) ([]string, error)
- func (f *FileStore) ReplaceGroup(ctx context.Context, id string, g Group) (Group, error)
- func (f *FileStore) ReplaceUser(ctx context.Context, id string, u User) (User, error)
- type Filter
- type Group
- type Handler
- type Memory
- func (m *Memory) CreateGroup(_ context.Context, g Group) (Group, error)
- func (m *Memory) CreateUser(_ context.Context, u User) (User, error)
- func (m *Memory) DeleteGroup(_ context.Context, id string) error
- func (m *Memory) DeleteUser(_ context.Context, id string) error
- func (m *Memory) GetGroup(_ context.Context, id string) (Group, error)
- func (m *Memory) GetUser(_ context.Context, id string) (User, error)
- func (m *Memory) ListGroups(_ context.Context, filter Filter) ([]Group, error)
- func (m *Memory) ListUsers(_ context.Context, filter Filter) ([]User, error)
- func (m *Memory) MembersOf(_ context.Context, groupName string) ([]string, error)
- func (m *Memory) ReplaceGroup(_ context.Context, id string, g Group) (Group, error)
- func (m *Memory) ReplaceUser(_ context.Context, id string, u User) (User, error)
- type Store
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a SCIM resource is missing. ErrNotFound = errors.New("scim: not found") // ErrConflict is returned when uniqueness is violated (e.g., // two Users with the same userName). ErrConflict = errors.New("scim: conflict") // ErrInvalidFilter signals an unsupported SCIM filter; maps // to SCIM error code "invalidFilter". ErrInvalidFilter = errors.New("scim: invalid filter") )
Errors returned by Store implementations.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore persists the SCIM directory to a JSON file. The in-memory `Memory` store handles read paths; mutation paths delegate to it and then persist the file atomically.
Suitable for §6.3.1 deployments with hundreds of users / groups and infrequent IdP pushes. Heavier deployments should use a SQL-backed store.
func LoadFileStore ¶
LoadFileStore reads path (when present) and returns a SCIM store pre-populated with every record. Missing path yields an empty store that creates the file on the first mutation.
func (*FileStore) CreateGroup ¶
CreateGroup delegates and persists.
func (*FileStore) CreateUser ¶
CreateUser delegates to the embedded Memory store and persists.
func (*FileStore) DeleteGroup ¶
DeleteGroup delegates and persists.
func (*FileStore) DeleteUser ¶
DeleteUser delegates and persists.
func (*FileStore) ListGroups ¶
ListGroups delegates to the embedded Memory store.
func (*FileStore) ReplaceGroup ¶
ReplaceGroup delegates and persists.
type Filter ¶
type Filter struct {
Attribute string // userName | displayName | active | externalId
Operator string // eq | sw | co | pr
Value string
}
Filter is the parsed §6.3.1 SCIM filter expression. Empty matches everything.
type Group ¶
type Group struct {
ID string
DisplayName string
MemberIDs []string
CreatedAt time.Time
UpdatedAt time.Time
}
Group is the §6.3.1 group resource.
type Handler ¶
Handler is the SCIM HTTP front-end. Mount under /scim/v2/.
Routes:
GET /Users[/{id}]
POST /Users
PUT /Users/{id}
DELETE /Users/{id}
GET /Groups[/{id}]
POST /Groups
PUT /Groups/{id}
DELETE /Groups/{id}
Auth: bearer token validated against the configured Tokens set.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is an in-memory Store. Used by tests and standalone deployments that don't need SCIM persistence across restarts.
func (*Memory) CreateGroup ¶
CreateGroup persists g and returns its committed form.
func (*Memory) CreateUser ¶
CreateUser stores u and returns the persisted form (with ID set).
func (*Memory) DeleteGroup ¶
DeleteGroup removes the group; missing id is a no-op.
func (*Memory) DeleteUser ¶
DeleteUser removes the user; missing id is a no-op.
func (*Memory) ListGroups ¶
ListGroups returns every group matching filter.
func (*Memory) MembersOf ¶
MembersOf returns userName values for every user in the named group. Used by the §4.6 visibility evaluator to expand `groups:` filters.
func (*Memory) ReplaceGroup ¶
ReplaceGroup overwrites the stored group.
type Store ¶
type Store interface {
CreateUser(ctx context.Context, u User) (User, error)
GetUser(ctx context.Context, id string) (User, error)
ListUsers(ctx context.Context, filter Filter) ([]User, error)
ReplaceUser(ctx context.Context, id string, u User) (User, error)
DeleteUser(ctx context.Context, id string) error
CreateGroup(ctx context.Context, g Group) (Group, error)
GetGroup(ctx context.Context, id string) (Group, error)
ListGroups(ctx context.Context, filter Filter) ([]Group, error)
ReplaceGroup(ctx context.Context, id string, g Group) (Group, error)
DeleteGroup(ctx context.Context, id string) error
// MembersOf returns the SCIM userNames of every user in the
// named group. Used by the visibility evaluator to expand
// `groups:` filters in layer config.
MembersOf(ctx context.Context, groupName string) ([]string, error)
}
Store is the SPI implementations satisfy.