Documentation
¶
Overview ¶
Package scim provides an inbound Better Auth-shaped SCIM 2.0 provisioning service.
Stability: Experimental. This package is tested but is outside the better-auth-go v1 compatibility guarantee pending pinned differential and live enterprise-directory interoperability certification.
Index ¶
- Constants
- func New(config Config) (betterauth.Plugin, error)
- type Config
- type DefaultConnection
- type Email
- type ExistingUserLinkPolicy
- type Filter
- type Hooks
- type Name
- type OrganizationAuthorizer
- type OrganizationRoleAuthorizer
- type PatchOperation
- type PatchRequest
- type ProviderConnection
- type ResourceMeta
- type SCIMError
- type TokenGeneratedHook
- type UserHook
- type UserInput
- type UserResource
Constants ¶
View Source
const ( ModelSCIMProvider = "scimProvider" SchemaUser = "urn:ietf:params:scim:schemas:core:2.0:User" SchemaSchema = "urn:ietf:params:scim:schemas:core:2.0:Schema" SchemaResourceType = "urn:ietf:params:scim:schemas:core:2.0:ResourceType" SchemaListResponse = "urn:ietf:params:scim:api:messages:2.0:ListResponse" SchemaPatch = "urn:ietf:params:scim:api:messages:2.0:PatchOp" SchemaError = "urn:ietf:params:scim:api:messages:2.0:Error" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
OrganizationAuthorizer OrganizationAuthorizer
DefaultConnections []DefaultConnection
RequiredRoles []string
ReservedProviderIDs []string
ProviderOwnership bool
ProviderLimit int
TokenTTL time.Duration
MaxBearerBytes int
MaxFilterBytes int
MaxFilterClauses int
MaxPatchOperations int
MaxPageSize int
LinkExistingUsers ExistingUserLinkPolicy
CanGenerateToken func(*betterauth.HookContext, string, string) (bool, error)
Hooks Hooks
Schema betterauth.ModelSchema
}
type DefaultConnection ¶
type DefaultConnection struct {
ProviderID string
TokenHash string
OrganizationID string
UserID string
ExpiresAt *time.Time
}
DefaultConnection is for deterministic test and migration fixtures. TokenHash must already be a core HashToken value; raw tokens are never accepted here.
type ExistingUserLinkPolicy ¶
type ExistingUserLinkPolicy struct {
Enabled bool
TrustedDomains []string
RequireExistingOrgMembership bool
Allow func(*betterauth.HookContext, betterauth.User, string, ProviderConnection) (bool, error)
}
type Hooks ¶
type Hooks struct {
BeforeTokenGenerated TokenGeneratedHook
AfterTokenGenerated TokenGeneratedHook
BeforeUserCreate UserHook
AfterUserCreate UserHook
BeforeUserUpdate UserHook
AfterUserUpdate UserHook
BeforeUserDelete UserHook
AfterUserDelete UserHook
}
type OrganizationAuthorizer ¶
type OrganizationAuthorizer interface {
AuthorizeSCIMConnection(*betterauth.HookContext, string) error
IsSCIMMember(*betterauth.HookContext, string, string) (bool, error)
// AddSCIMMember and RemoveSCIMMember receive a request copy whose Database
// is the active provisioning transaction. Implementations must use that
// adapter for membership persistence and must not retain the context.
AddSCIMMember(*betterauth.HookContext, string, string) error
RemoveSCIMMember(*betterauth.HookContext, string, string) error
}
type OrganizationRoleAuthorizer ¶
type OrganizationRoleAuthorizer interface {
AuthorizeSCIMConnectionRoles(*betterauth.HookContext, string, []string) error
}
OrganizationRoleAuthorizer is the role-aware extension used when available. The base OrganizationAuthorizer remains supported for applications whose authorization port already encapsulates the same role policy.
type PatchOperation ¶
type PatchRequest ¶
type PatchRequest struct {
Schemas []string `json:"schemas"`
Operations []PatchOperation `json:"Operations"`
}
type ProviderConnection ¶
type ProviderConnection struct {
ID string `json:"id"`
ProviderID string `json:"providerId"`
OrganizationID string `json:"organizationId,omitempty"`
UserID string `json:"userId,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
}
type ResourceMeta ¶
type TokenGeneratedHook ¶
type TokenGeneratedHook func( *betterauth.HookContext, betterauth.User, ProviderConnection, ) error
type UserHook ¶
type UserHook func( *betterauth.HookContext, betterauth.User, ProviderConnection, ) error
type UserResource ¶
type UserResource struct {
Schemas []string `json:"schemas"`
ID string `json:"id"`
ExternalID string `json:"externalId,omitempty"`
UserName string `json:"userName"`
Name *Name `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Active bool `json:"active"`
Emails []Email `json:"emails,omitempty"`
Meta ResourceMeta `json:"meta"`
}
Click to show internal directories.
Click to hide internal directories.