Documentation
¶
Overview ¶
Package scim implements a minimal SCIM 2.0 provisioning client. idpzero acts as the SCIM client and pushes its configured users to an external SCIM service (the service provider). Only the User resource is supported.
Index ¶
Constants ¶
const ( ActionCreated = "created" ActionUpdated = "updated" ActionFailed = "failed" )
Action describes what happened to a single user during a sync.
const ( UserSchema = "urn:ietf:params:scim:schemas:core:2.0:User" ListSchema = "urn:ietf:params:scim:api:messages:2.0:ListResponse" ErrorSchema = "urn:ietf:params:scim:api:messages:2.0:Error" // ContentType is the media type SCIM uses for request and response bodies. ContentType = "application/scim+json" )
SCIM schema URNs (RFC 7643 / 7644).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimal SCIM 2.0 client for the User resource. It targets a single service provider identified by its base URL (e.g. https://host/scim/v2).
func New ¶
New builds a SCIM client for the given endpoint. token is optional; when empty no Authorization header is sent.
func (*Client) FindByExternalID ¶
FindByExternalID looks up a user by its externalId, returning nil when no match exists. idpzero sets externalId to the user's Subject.
type Email ¶
type Email struct {
Value string `json:"value"`
Type string `json:"type,omitempty"`
Primary bool `json:"primary,omitempty"`
}
Email is a single SCIM multi-valued "emails" entry.
type ErrorResponse ¶
type ErrorResponse struct {
Schemas []string `json:"schemas"`
Detail string `json:"detail"`
Status string `json:"status"`
}
ErrorResponse is the SCIM error envelope returned on non-2xx responses.
type ListResponse ¶
type ListResponse struct {
Schemas []string `json:"schemas"`
TotalResults int `json:"totalResults"`
Resources []User `json:"Resources"`
}
ListResponse is the SCIM envelope returned by query/list operations.
type Name ¶
type Name struct {
Formatted string `json:"formatted,omitempty"`
GivenName string `json:"givenName,omitempty"`
MiddleName string `json:"middleName,omitempty"`
FamilyName string `json:"familyName,omitempty"`
}
Name is the SCIM complex "name" attribute.
type PhoneNumber ¶
type PhoneNumber struct {
Value string `json:"value"`
Type string `json:"type,omitempty"`
Primary bool `json:"primary,omitempty"`
}
PhoneNumber is a single SCIM multi-valued "phoneNumbers" entry.
type Report ¶
Report is the outcome of a full sync run.
type Result ¶
type Result struct {
Subject string
UserName string
Action string // created | updated | failed
Err string // populated when Action == failed
}
Result is the outcome of provisioning a single user.
type User ¶
type User struct {
Schemas []string `json:"schemas"`
ID string `json:"id,omitempty"` // assigned by the service provider
ExternalID string `json:"externalId,omitempty"` // idpzero's stable subject
UserName string `json:"userName"`
DisplayName string `json:"displayName,omitempty"`
Name *Name `json:"name,omitempty"`
Emails []Email `json:"emails,omitempty"`
PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"`
Active bool `json:"active"`
}
User is a SCIM 2.0 core User resource. Only the subset of attributes idpzero can populate from its configured users is modelled here.
func ToSCIMUser ¶
func ToSCIMUser(u *configuration.User) User
ToSCIMUser maps an idpzero configured user onto a SCIM 2.0 User resource.
The idpzero Subject is used as the SCIM externalId so provisioning is idempotent: the target is queried by externalId to decide between create and replace. Claim fields are optional pointers on the source, so every access is nil-guarded.