Documentation
¶
Overview ¶
Package adapter holds the provider-specific rules of SCIM connections.
Shared SCIM code never infers provider behavior from names, prefixes, or identifier shapes. The registry maps an auth provider name to its adapter when a connection is created, and the connection persists the adapter's type, which selects the provider-specific rules from then on. Supporting another provider means registering another adapter.
Index ¶
- func ConnectionAdapterType(conn *types.SCIMConnection) string
- func DirectoryParametersProvided(a Adapter, config map[string]string) bool
- func LocalizedDirectoryDescription(authProviderName, parameterName, description, locale string) (string, bool)
- func SupportsSCIM(authProviderName string, manifest types2.AuthProviderManifest) bool
- type Adapter
- type DirectoryParameter
- type Identity
- type InvalidUserError
- type Parameters
- type PatchRules
- type ProviderState
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionAdapterType ¶
func ConnectionAdapterType(conn *types.SCIMConnection) string
ConnectionAdapterType returns the adapter type of conn, an auth provider's SCIM connection, or an empty string when conn is nil, as ProviderState.ConnectionAdapterType takes it.
func DirectoryParametersProvided ¶
DirectoryParametersProvided reports whether config holds any of the adapter's directory parameters. Empty values count as absent. Providing them chooses directory synchronization, and omitting them all chooses SCIM.
func LocalizedDirectoryDescription ¶
func LocalizedDirectoryDescription(authProviderName, parameterName, description, locale string) (string, bool)
LocalizedDirectoryDescription returns localized text only for descriptions generated by an adapter.
func SupportsSCIM ¶
func SupportsSCIM(authProviderName string, manifest types2.AuthProviderManifest) bool
SupportsSCIM reports whether the named auth provider can have a SCIM connection: the registry has an adapter for it, and its manifest declares a group ID prefix, which groups created through SCIM keep.
Types ¶
type Adapter ¶
type Adapter interface {
// Type is the adapter's persisted type.
Type() string
// DirectoryParameters are the auth provider configuration parameters that only login-time directory
// synchronization uses.
DirectoryParameters() []DirectoryParameter
// IssuerConfigurationParameter names the auth provider configuration parameter that holds the identity
// provider's issuer URL.
IssuerConfigurationParameter() string
// NativeUserID returns the identity provider's immutable ID for a SCIM user. A user binds to the existing
// identity of the connection's auth provider that stores the same ID.
NativeUserID(user User) (string, error)
// NewUserIdentity returns the Obot username and identity fields for a user that SCIM creates, so that the user's
// later sign-ins find the same identity.
NewUserIdentity(nativeUserID string) Identity
// NewGroupID returns the Obot ID for a group that SCIM creates.
NewGroupID(groupIDPrefix, scimID string) string
// NativeGroupID returns the identity provider's own ID of the group with the given Obot ID, or an empty string
// when the Obot ID does not carry one, such as the ID of a group that SCIM created.
NativeGroupID(groupIDPrefix, groupID string) string
// GroupConsoleURL returns the address of a group in the identity provider's admin console, or an empty string
// when it cannot be built from the issuer.
GroupConsoleURL(issuer, nativeGroupID string) string
// PatchRules returns how the identity provider's PATCH requests depart from RFC 7644.
PatchRules() PatchRules
}
Adapter holds the rules that differ between identity providers.
func ForAuthProvider ¶
ForAuthProvider returns the adapter of the named auth provider, and whether the provider supports SCIM.
type DirectoryParameter ¶
type DirectoryParameter struct {
Name string
// SetupDescription describes the parameter while the auth provider is being configured, when providing it
// chooses directory synchronization and omitting it chooses SCIM.
SetupDescription string
SetupTranslations map[string]string
// UnusedDescription describes the parameter once a SCIM connection has replaced directory synchronization.
UnusedDescription string
UnusedTranslations map[string]string
}
DirectoryParameter is a configuration parameter that only login-time directory synchronization uses, with the descriptions the configuration form shows for it.
type Identity ¶
type Identity struct {
Username string
ProviderUsername string
ProviderUserID string
ProviderGroupLookupID string
}
Identity holds the Obot user and identity fields for a user that SCIM creates.
type InvalidUserError ¶
type InvalidUserError struct {
Message string
}
InvalidUserError reports a SCIM user that lacks the attributes the adapter needs.
func (*InvalidUserError) Error ¶
func (e *InvalidUserError) Error() string
type Parameters ¶
type Parameters struct {
Required []types2.ProviderConfigurationParameter
Optional []types2.ProviderConfigurationParameter
// Dropped names the parameters that a submitted configuration must not keep.
Dropped []string
// Together names optional parameters that a configuration must hold all of or none of, because the auth
// provider refuses to start with only some of them.
Together []string
}
Parameters are an auth provider's effective configuration parameters, which depend on its SCIM setup. Every check of whether the provider is configured uses Required, and the configuration form shows Required and Optional.
func EffectiveParameters ¶
func EffectiveParameters(manifest types2.AuthProviderManifest, state ProviderState) Parameters
EffectiveParameters returns an auth provider's effective configuration parameters, from its manifest, its adapter, its SCIM connection, and its stored configuration.
Only the adapter's directory parameters differ from the manifest:
- A provider that is being configured or staged, and has no connection, may omit them: providing them sets up directory synchronization, and omitting them sets up SCIM. They are optional, described as that choice, and must be provided together.
- A configured provider without a connection synchronizes its directory at sign-in, so they are required as the manifest lists them.
- With a connection, they are never required. If the stored configuration still holds them, they are optional and described as unused, so they can be removed. Otherwise they are absent, and dropped if submitted.
func (Parameters) IncompleteGroup ¶
func (p Parameters) IncompleteGroup(config map[string]string) []string
IncompleteGroup returns the parameters of Together that config lacks when it holds some but not all of them, and nothing otherwise. Empty values count as absent.
type PatchRules ¶
type PatchRules struct {
// ReplaceAddsUnmatched makes a replace whose value filter selects no value do what an add does and create the
// value, where RFC 7644 section 3.5.2.3 fails it with noTarget. Microsoft Entra ID sends a replace of
// emails[type eq "work"].value for a user who has no work email.
ReplaceAddsUnmatched bool
}
PatchRules holds how an identity provider's PATCH requests depart from RFC 7644. The SCIM endpoint accepts such a request only from the connections of that provider.
type ProviderState ¶
type ProviderState struct {
// AuthProviderName names the auth provider. Without a SCIM connection, it selects the provider's adapter.
AuthProviderName string
// Configured is set when the configuration being described is the provider's active one: for the configured
// auth provider, and for every check of whether a stored configuration is complete. Without a SCIM connection,
// such a provider synchronizes its directory at sign-in.
Configured bool
// ConnectionAdapterType is the adapter type of the provider's SCIM connection, or empty when it has none.
ConnectionAdapterType string
// Stored is the provider's stored configuration, or nil when it has none.
Stored map[string]string
}
ProviderState is what an auth provider's effective configuration parameters depend on, besides its manifest.