mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:57:32 +00:00
feat: create user scim v2 endpoint (#9132)
# Which Problems Are Solved - Adds infrastructure code (basic implementation, error handling, middlewares, ...) to implement the SCIM v2 interface - Adds support for the user create SCIM v2 endpoint # How the Problems Are Solved - Adds support for the user create SCIM v2 endpoint under `POST /scim/v2/{orgID}/Users` # Additional Context Part of #8140
This commit is contained in:
60
internal/api/scim/metadata/metadata.go
Normal file
60
internal/api/scim/metadata/metadata.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package metadata
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Key string
|
||||
type ScopedKey string
|
||||
|
||||
const (
|
||||
externalIdProvisioningDomainPlaceholder = "{provisioningDomain}"
|
||||
|
||||
KeyPrefix = "urn:zitadel:scim:"
|
||||
KeyProvisioningDomain Key = KeyPrefix + "provisioning_domain"
|
||||
|
||||
KeyExternalId Key = KeyPrefix + "externalId"
|
||||
keyScopedExternalIdTemplate = KeyPrefix + externalIdProvisioningDomainPlaceholder + ":externalId"
|
||||
KeyMiddleName Key = KeyPrefix + "name.middleName"
|
||||
KeyHonorificPrefix Key = KeyPrefix + "name.honorificPrefix"
|
||||
KeyHonorificSuffix Key = KeyPrefix + "name.honorificSuffix"
|
||||
KeyProfileUrl Key = KeyPrefix + "profileURL"
|
||||
KeyTitle Key = KeyPrefix + "title"
|
||||
KeyLocale Key = KeyPrefix + "locale"
|
||||
KeyTimezone Key = KeyPrefix + "timezone"
|
||||
KeyIms Key = KeyPrefix + "ims"
|
||||
KeyPhotos Key = KeyPrefix + "photos"
|
||||
KeyAddresses Key = KeyPrefix + "addresses"
|
||||
KeyEntitlements Key = KeyPrefix + "entitlements"
|
||||
KeyRoles Key = KeyPrefix + "roles"
|
||||
)
|
||||
|
||||
var ScimUserRelevantMetadataKeys = []Key{
|
||||
KeyExternalId,
|
||||
KeyMiddleName,
|
||||
KeyHonorificPrefix,
|
||||
KeyHonorificSuffix,
|
||||
KeyProfileUrl,
|
||||
KeyTitle,
|
||||
KeyLocale,
|
||||
KeyTimezone,
|
||||
KeyIms,
|
||||
KeyPhotos,
|
||||
KeyAddresses,
|
||||
KeyEntitlements,
|
||||
KeyRoles,
|
||||
}
|
||||
|
||||
func ScopeExternalIdKey(provisioningDomain string) ScopedKey {
|
||||
return ScopedKey(strings.Replace(keyScopedExternalIdTemplate, externalIdProvisioningDomainPlaceholder, provisioningDomain, 1))
|
||||
}
|
||||
|
||||
func ScopeKey(ctx context.Context, key Key) ScopedKey {
|
||||
// only the externalID is scoped
|
||||
if key == KeyExternalId {
|
||||
return GetScimContextData(ctx).ExternalIDScopedMetadataKey
|
||||
}
|
||||
|
||||
return ScopedKey(key)
|
||||
}
|
Reference in New Issue
Block a user