Skip to main content

SCIM2 Schemas

getSchemas retrieves the SCIM2 schema definitions from ThunderID. Use schemas to discover available user attributes, their types, and validation rules before building profile forms or processing user data.

getSchemas(config)

import { getSchemas } from '@thunderid/javascript'

const schemas = await getSchemas({
baseUrl: 'https://localhost:8090',
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

schemas.forEach(schema => {
console.log(schema.name, schema.attributes.map(a => a.name))
})

Parameters

ParameterTypeRequiredDescription
config.urlstringFull SCIM2 schemas endpoint URL. Mutually exclusive with baseUrl
config.baseUrlstringThunderID base URL. SDK appends /scim2/Schemas
config.fetcherfunctionCustom fetch function override
config.headersRecord<string, string>Additional request headers

Response: Schema[]

An array of schema definitions.

Schema

PropertyTypeDescription
idstringSchema URI (e.g., 'urn:ietf:params:scim:schemas:core:2.0:User')
namestringSchema name (e.g., 'User')
descriptionstringSchema description
attributesSchemaAttribute[]Attribute definitions

SchemaAttribute

PropertyTypeDescription
namestringAttribute name (e.g., 'userName', 'emails')
typestringData type: 'STRING', 'BOOLEAN', 'DECIMAL', 'INTEGER', 'DATETIME', 'BINARY', 'REFERENCE', 'COMPLEX'
displayNamestringHuman-readable attribute label
descriptionstringAttribute description
requiredbooleanWhether the attribute is required
multiValuedbooleanWhether the attribute can hold multiple values
caseExactbooleanWhether string comparisons are case-sensitive
returnedstringWhen the attribute is returned: 'always', 'never', 'default', 'request'
uniquenessstringUniqueness constraint: 'none', 'server', 'global'
regExstringValidation regex pattern
subAttributesSchemaAttribute[]Nested attributes for complex types

Well-Known Schema IDs

Use WellKnownSchemaIds to reference standard schema URIs without hardcoding strings:

import { WellKnownSchemaIds } from '@thunderid/javascript'

const userSchema = schemas.find(s => s.id === WellKnownSchemaIds.User)
ConstantValueDescription
WellKnownSchemaIds.Coreurn:ietf:params:scim:schemas:core:2.0SCIM2 core schema
WellKnownSchemaIds.Userurn:ietf:params:scim:schemas:core:2.0:UserStandard user attributes
WellKnownSchemaIds.EnterpriseUserurn:ietf:params:scim:schemas:extension:enterprise:2.0:UserEnterprise user extension
WellKnownSchemaIds.SystemUserurn:scim:wso2:schemaWSO2 system attributes
WellKnownSchemaIds.CustomUserurn:scim:custom:schemaCustom user attributes

Utility Functions

The SDK provides helpers for working with schema data:

flattenUserSchema(schemas, user)

Produce a flat Record<string, any> from nested SCIM2 attribute paths.

import { flattenUserSchema } from '@thunderid/javascript'

const flat = flattenUserSchema(schemas, userProfile)
// { 'urn:ietf:...name.givenName': 'Alice', 'urn:ietf:...emails[0].value': 'alice@example.com' }

generateUserProfile(flatProfile, schemas)

Convert a flat profile map back to a typed UserProfile.

import { generateUserProfile } from '@thunderid/javascript'

const profile = generateUserProfile(flatProfile, schemas)

Returns: UserProfile{ profile, flattenedProfile, schemas[] }

generateFlattenedUserProfile(profile, schemas)

Generate a flattened version of a full SCIM2 user profile directly.

import { generateFlattenedUserProfile } from '@thunderid/javascript'

const flat = generateFlattenedUserProfile(user, schemas)

Returns: User

resolveFieldType(scimType)

Map a SCIM2 attribute type string to a FieldType enum value for rendering form inputs.

import { resolveFieldType, FieldType } from '@thunderid/javascript'

const fieldType = resolveFieldType('STRING') // FieldType.Text

resolveFieldName(schema, path)

Resolve a human-readable display name for a SCIM2 attribute path.

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy