Module scim
API
Definitions
ballerinax/scim Ballerina library
Package overview
This package contains a client connector that can be used for inbound provisioning of users and groups to an Asgardeo Organization through the SCIM2.0 /Users, /Groups and /Bulk endpoints by using SCIM protocol. It also contains a set of SCIM schema records defined following the SCIM specification, that can be used to map SCIM objects and do operations in an easy manner.
Capabilities
- SCIM schemas defined as Ballerina records
- Provisioning users through Users endpoint
- Provisioning groups through Groups endpoint
- Provisioning users and groups through Bulk endpoint
Usage
To use this package import the package to a Ballerina program.
import ballerinax/scim;
Initialize the connector configuration record.
scim:ConnectorConfig config = { orgName: "<orgName>", clientId: "<clientId>", clientSecret : "<clientSecret>", scope : ["<scope1>", "<scope2>"] };
Initialize the connector.
scim:Client client1 = check new(scim:ConnectorConfig config);
Invoke the connector operations by passing the required parameters.
scim:UserResource response= check scimClient->getUser("<userId>");
Clients
scim: Client
This client is used to connect to the SCIM2 APIs of Asgardeo for Inbound User Provisioning.
Constructor
Initializes the SCIM client.
init (ConnectorConfig connectorConfig)
- connectorConfig ConnectorConfig - The connector configuration
getUsers
function getUsers(string[]? attributes, int? count, string? domain, string[]? excludedAttributes, string? filter, int? startIndex) returns UserResponse|ErrorResponse|error
Filter the users.
Parameters
- attributes string[]? (default ()) - SCIM defined attributes parameter
- count int? (default ()) - Specifies the desired maximum number of query results per page
- domain string? (default "DEFAULT") - The name of the user store where filtering needs to be applied
- excludedAttributes string[]? (default ()) - SCIM defined excludedAttribute parameter
- filter string? (default ()) - Filter expression for filtering
- startIndex int? (default ()) - The 1-based index of the first query result
Return Type
- UserResponse|ErrorResponse|error - The list of users
getUser
function getUser(string id, string[]? attributes, string[]? excludedAttributes) returns UserResource|ErrorResponse|error
Gets a user by the user ID.
Parameters
- id string - The ID of the user
- attributes string[]? (default ()) - SCIM defined attributes parameter
- excludedAttributes string[]? (default ()) - SCIM defined excludedAttribute parameter
Return Type
- UserResource|ErrorResponse|error - The user
createUser
function createUser(UserCreate data) returns UserResource|ErrorResponse|error
Creates a user.
Parameters
- data UserCreate - The user data
Return Type
- UserResource|ErrorResponse|error - The created user
updateUser
function updateUser(string id, UserUpdate data) returns UserResource|ErrorResponse|error
Updates user data.
Return Type
- UserResource|ErrorResponse|error - The updated user
deleteUser
function deleteUser(string id) returns ErrorResponse|error?
Deletes a user.
Parameters
- id string - The ID of the user
Return Type
- ErrorResponse|error? - The response
patchUser
function patchUser(string id, UserPatch data) returns UserResponse|ErrorResponse|error
Patches user data.
Return Type
- UserResponse|ErrorResponse|error - The patched user
searchUser
function searchUser(UserSearch data) returns UserResponse|ErrorResponse|error
Searches for a user.
Parameters
- data UserSearch - The search data
Return Type
- UserResponse|ErrorResponse|error - The list of users
getGroups
function getGroups(string[]? attributes, int? count, string? domain, string[]? excludedAttributes, string? filter, int? startIndex) returns GroupResponse|ErrorResponse|error
Filter the groups.
Parameters
- attributes string[]? (default ()) - SCIM defined attributes parameter
- count int? (default ()) - Specifies the desired maximum number of query results per page
- domain string? (default ()) - The name of the user store where filtering needs to be applied
- excludedAttributes string[]? (default ()) - SCIM defined excludedAttribute parameter
- filter string? (default ()) - Filter expression for filtering
- startIndex int? (default ()) - The 1-based index of the first query result
Return Type
- GroupResponse|ErrorResponse|error - The list of groups
getGroup
function getGroup(string id, string[]? attributes, string[]? excludedAttributes) returns GroupResource|ErrorResponse|error
Gets a group by the group ID.
Parameters
- id string - The ID of the group
- attributes string[]? (default ()) - SCIM defined attributes parameter
- excludedAttributes string[]? (default ()) - SCIM defined excludedAttribute parameter
Return Type
- GroupResource|ErrorResponse|error - The group
createGroup
function createGroup(GroupCreate data) returns GroupResource|ErrorResponse|error
Creates a group.
Parameters
- data GroupCreate - The group data
Return Type
- GroupResource|ErrorResponse|error - The created group
updateGroup
function updateGroup(string id, GroupUpdate data) returns GroupResource|error
Updates a group.
Return Type
- GroupResource|error - The updated group
deleteGroup
function deleteGroup(string id) returns ErrorResponse|error?
Deletes a group.
Parameters
- id string - The ID of the group
Return Type
- ErrorResponse|error? - The response
patchGroup
function patchGroup(string id, GroupPatch data) returns GroupResponse|ErrorResponse|error
Patches a group.
Return Type
- GroupResponse|ErrorResponse|error - The patched group
searchGroup
function searchGroup(GroupSearch data) returns GroupResponse|ErrorResponse|error
Searches for a group.
Parameters
- data GroupSearch - The search data
Return Type
- GroupResponse|ErrorResponse|error - The list of groups
bulk
function bulk(Bulk data) returns BulkResponse|ErrorResponse|error
Performs a bulk operation.
Parameters
- data Bulk - The data for bulk operation
Return Type
- BulkResponse|ErrorResponse|error - The response of the operation
Enums
scim: addressType
Members
scim: emailType
Members
scim: groupType
Members
scim: imsType
Members
scim: memberType
Members
scim: opType
Members
scim: phoneType
Members
scim: photoType
Members
Records
scim: Address
Represents the sub-attributes of the addresses complex attribute in SCIMUser record.
Fields
- 'type addressType? - Type of the address
- streetAddress string? - Street address component
- locality string? - City or locality component
- region string? - State or region component
- postalCode string? - Zip code or postal code component
- country string? - Country name component
- formatted string? - Full mailing address
- primary boolean? - Whether the primary address
scim: Bulk
Represents the SCIM Bulk resource schema
Fields
- failOnErrors int? - Number of errors that the service provider will accept before the operation is terminated and an error response is returned
- schemas string[] - URIs of the SCIM schemas used in the request
- Operations Operation[] - List of operations within the bulk
scim: BulkPatch
Represents the Bulk request body, data attibute of PATCH method
Fields
- Operations BulkPatchOperation[] - List of operations within the bulk patch request
scim: BulkPatchOperation
Represents the Bulk request's data field attributes under the Operation record
Fields
- op string - Operation to be performed
- path string? - Path of the existing users/groups
scim: BulkResponse
Represents the response of the Bulk operations
Fields
- schemas string[] - URIs of the SCIM schemas used
- Operations BulkResponseOperation[] - List of operations
scim: BulkResponseOperation
Represents the sub-attributes of the Operations attribute of the BulkResponse record
Fields
- method string - Method of the operation
- location string? - Resource endpoint URL
- bulkId string? - BulkId of the operation (Found in the response only when the method is "POST")
- status Status - Http status code of the operation
- 'version string? - Current resource version (Found in the response only when the method is "POST", "PUT" and "PATCH")
scim: Certificate
Represents the sub-attributes of the certificates complex attribute in SCIMUser record.
Fields
- value string? - DER-encoded X.509 certificate
- display string? - Display name of the certificate
- 'type string? - Type of the certificate
- primary boolean? - Whether the certificate is the primary one
scim: ConnectorConfig
Represents the connector configurations
Fields
- orgName string - The name of the organization
- clientId string - The client ID of the application
- clientSecret string - The client secret of the application
- scope string[] - Permitted scopes
scim: Email
Represents the sub-attributes of the emails complex attribute in SCIMUser record.
Fields
- value string? - Canonicalized representation of the email value
- display string? - Name primarily used for display purposes
- 'type emailType? - Type of the email
- primary boolean? - Whether the primary email address
scim: Entitlement
Represents the sub-attributes of the entitlements complex attribute in SCIMUser record.
Fields
- value string? - The value of an entitlement
- display string? - The display name of the entitlement
- primary string? - Whether the entitlement is the primary one
- 'type string? - The type of the entitlement
scim: ErrorResponseDetails
Represents the error response
Fields
- detail string - Detailed error description
- status string - HTTP status code
- schemas string[] - URIs of the used SCIM schemas
- scimType string? - SCIM type
scim: GroupCreate
Represents the SCIM Group resource request body used for createGroup
Fields
- schemas string[](default ["urn:ietf:params:scim:schemas:core:2.0:Group"]) - URIs of the used SCIM schemas
- displayName string - Name for the Group
- members Member[]? - List of members of the Group
- meta Meta? - Metadata of the group
- roles Role? - List of roles for the group
- externalId string? - Identifier by the provisioning client
scim: GroupPatch
Represents the Request body of patchGroup method
Fields
- schemas string[](default ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]) - URIs of the used SCIM schemas
- Operations PatchOpGroup[] - List of operations
scim: GroupResource
Represents the Response of createGroup and getGroup methods
Fields
- displayName string? - Name for the Group
- meta Meta? - Metadata of the group
- members Member[]? - List of members of the Group
- roles Role[]? - List of roles for the group
- id string? - Unique identifier by service provider
- schemas string[]? - The list of schema URIs used
- externalId string? - Identifier by the provisioning client
scim: GroupResponse
Represents the response of by getGroups and searchGroup methods
Fields
- totalResults int? - Total number of results
- startIndex int? - Starting index of the returned results
- itemsPerPage int? - Number of results returned per page
- schemas string[]? - The list of schema URIs used
- Resources GroupResource[]? - The list of group resources
scim: Groups
Represents the sub-attributes of the groups complex attribute in SCIMUser record.
Fields
- value string? - Id of the group
- display string? - Name of the group
- \$ref string? - Reference URI
- 'type groupType? - Type of the group
scim: GroupSearch
Represents the Request body of searchGroup method
Fields
- attributes string[]? - Names of resource attributes to return
- excludedAttributes string[]? - Names of resource attributes to be removed from the default set of attributes to return
- sortBy string? - Attribute used to order the returned responses
- sortOrder string? - order in which the sortBy parameter is applied
- schemas string[](default ["urn:ietf:params:scim:api:messages:2.0:SearchRequest"]) - URIs of the used SCIM schemas
- filter string? - Filter expression
- startIndex int? - Starting index of the first query results
- count int? - Maximum number of query results per page
- domain string? - Domain name
scim: GroupUpdate
Represents the Response of updateGroup method
Fields
- schemas string[]? - The list of schema URIs used
- displayName string? - Name for the Group
- members Member[]? - List of members of the Group
- meta Meta? - Metadata of the group
- roles Role? - List of roles for the group
- externalId string? - Identifier by the provisioning client
scim: Ims
Represents the sub-attributes of the ims complex attribute in SCIMUser record.
Fields
- value string? - Instant messaging address
- 'type imsType? - Type of the IM address
- display string? - Name primarily used for display purposes
- primary boolean? - Whether the primary IM address
scim: Manager
Represents the sub-attributes of the manager attribute in the SCIMEnterpriseUser record.
Fields
- value string? - Id of the SCIM resource representing the manager of the user
- displayName string? - DisplayName of the manager of the user
- \$ref string? - Reference URI
scim: Member
Represents the sub-attributes of members attribute of SCIM Group resource schema
Fields
- value string? - Value of an "id" attribute of a SCIM resource
- display string? - Name used to display
- \$ref string? - Reference URI
- 'type memberType? - Type of the member
scim: Meta
Represents the sub-attributes of the meta complex attribute in SCIMUser record.
Fields
- created string - DateTime that the resource was added
- location string - URI of the resource being returned
- lastModified string - Most recent DateTime that the details of this resource were updated
- resourceType string? - Name of the resource type of the resource
- 'version string? - Version of the resource being returned
scim: Name
Represents the sub-attributes of the name complex attribute in SCIMUser record.
Fields
- formatted string? - Full name, including all middle names, titles, and suffixes as appropriate, formatted for display
- givenName string? - Given name of the User
- familyName string? - Family name of the User
- middleName string? - Middle name(s) of the User
- honorificPrefix string? - Title
- honorificSuffix string? - Suffix
scim: Operation
Represents the sub-attributes of the Operations attribute of the Bulk resource schema
Fields
- method string - HTTP method of the current operation ["POST", "PUT", "PATCH", or "DELETE"]
- path string - Path of the operation
- bulkId string? - BulkId of the operation (required when the method is "POST" )
- 'version string? -
scim: PatchOperations
Represents the sub-attributes of the operations in userPatch record.
Fields
- op opType - Operation to be performed
- path string? - Target of the operation
- value UserUpdate? - Values to be used for the operation
scim: PatchOpGroup
Represents the sub-attributes of Operations attribute of GroupPatch record
Fields
- op opType - Operation to be performed
- path string? - Target of the operation
- value GroupUpdate - Value to be used for the operation
scim: Phone
Represents the sub-attributes of the phoneNumbers complex attribute in SCIMUser record.
Fields
- value string? - Phonenumber in accordance with the format defined
- 'type phoneType? - Type of the phone number
- display string? - Name used for display purposes
- primary boolean? - Whether the primary phone number
scim: Photo
Represents the sub-attributes of the photos complex attribute in SCIMUser record.
Fields
- value string? - URI of the photo
- 'type photoType? - Type of the photo
- display string? - Name primarily used for display purposes
- primary boolean? - Whether the primary photo
scim: Role
Represents the sub-attributes of the roles complex attribute in SCIMUser record.
Fields
- display string? - Human readable name, primarily used for display purposes
- value string? - Label representing a collection of entitlements
- primary boolean? - Whether the role is the primary role for the user
- \$ref string? - Reference URI
- resourceType string? - Resource type of the entitlement
scim: SCIMEnterpriseUser
Represents the SCIM Enterprise User extensioon resource.
Fields
- employeeNumber string? - Identifier in association with the organization.
- costCenter string? - Name of a cost center
- organization string? - Name of an organization
- division string? - Name of a division
- department string? - Name of a department
- manager Manager? - Manager of the user
scim: SCIMGroup
Represents the SCIM Group schema
Fields
- schemas string[]? - The list of schema URIs used
- displayName string - Name for the Group
- members Member[]? - List of members of the Group
- meta Meta? - Metadata of the group
- roles Role? - List of roles for the group
- externalId string? - Identifier by the provisioning client
scim: SCIMUser
Represents the SCIM USER schema.
Fields
- schemas string[]? - URIs of the used SCIM schemas
- externalId string? - Identifier by the provisioning client
- userName string? - Unique identifier within the system
- name Name? - Components of the user's name
- displayName string? - Name displayed to end-users
- nickName string? - Casual name of the user
- profileUrl string? - URI of the user's online profile
- emails Email[]? - Email addresses for the User
- addresses Address[]? - Physical mailing address for the user
- phoneNumbers Phone[]? - Phone numbers for the user
- entitlements Entitlement[]? - Entitlements for the User that represent a thing the User has
- ims Ims[]? - Instant messaging addresses for the user
- roles Role[]? - List of roles for the user
- photos Photo[]? - URI of image of the user
- userType string? - Relationship between the organization and the user
- title string? - Title of the user
- preferredLanguage string? - Preferred written or spoken languages of the user
- locale string? - Default location of the user
- timezone string? - Time zone of the user
- active boolean? - Administrative status of the user
- password string? - Password of the user
- groups Groups[]? - Groups to which the user belongs
- x509Certificates Certificate[]? - Certificates associated with the user
- meta Meta? - Metadata of the user
- urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2\.0\:User SCIMEnterpriseUser? - Attributes belong to business or enterprise extension schema
- urn\:scim\:wso2\:schema json? - Attributes belong to WSO2 custom extension schema
scim: Status
Represents the sub-attributes of the status attribute of the OperationResponse record
Fields
- code int - Http status code of the operation
scim: UserCreate
Represents the SCIM User resource request body used for createUser.
Fields
- externalId string? - Identifier by the provisioning client
- userName string? - Unique identifier within the system
- name Name? - Components of the user's name
- displayName string? - Name displayed to end-users
- nickName string? - Casual name of the user
- profileUrl string? - URI of the user's online profile
- emails Email[]? - Email addresses for the User
- addresses Address[]? - Physical mailing address for the user
- phoneNumbers Phone[]? - Phone numbers for the user
- ims Ims[]? - Instant messaging address for the user
- roles Role[]? - List of roles for the user
- photos Photo[]? - URI of image of the user
- entitlements Entitlement[]? - Entitlements for the User that represent a thing the User has
- userType string? - Relationship between the organization and the user
- title string? - Title of the user
- preferredLanguage string? - Preferred written or spoken languages of the user
- locale string? - Default location of the user
- timezone string? - Time zone of the user
- active boolean? - Administrative status of the user
- password string - Password of the user
- groups Groups[]? - Groups to which the user belongs
- x509Certificates Certificate[]? - Certificates associated with the user
- meta Meta? - Metadata of the user
- urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2\.0\:User SCIMEnterpriseUser? - Attributes belong to business or enterprise extension schema
- urn\:scim\:wso2\:schema json? - Attributes belong to WSO2 extension schema
scim: UserPatch
Represents the request body of userPatch operation.
Fields
- schemas string[](default ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]) - URIs of the used SCIM schemas
- Operations PatchOperations[] - List of operations to be performed
scim: UserResource
Represents the response of the createUser and getUser operations.
Fields
- id string? - Unique identifier by service provider
- externalId string? - Identifier by the provisioning client
- userName string? - Unique identifier for the user
- name Name? - Name of the user
- displayName string? - Name displayed to end-users
- nickName string? - Casual name of the user
- profileUrl string? - URI of the user's online profile
- emails string[]? - Email addresses for the User
- addresses Address[]? - Physical mailing address for the user
- phoneNumbers Phone[]? - Phone numbers for the user
- photos Photo[]? - URI of image of the user
- entitlements Entitlement[]? - List of entitlements for the user
- locale string? - Default location of the user
- active boolean? - Administrative status of the user
- meta Meta? - Metadata of the user
- urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2\.0\:User SCIMEnterpriseUser? - Attributes belong to business or enterprise extension schema
- urn\:scim\:wso2\:schema json? - Attributes belong to WSO2 custom extension schema
- roles Role[]? - List of roles for the user
scim: UserResponse
Represents the response of the getUsers and searchUser operations.
Fields
- totalResults int? - Total number of results
- startIndex int? - Starting index of the returned results
- itemsPerPage int? - Number of results returned per page
- schemas string[]? - URIs of the used SCIM schemas
- Resources UserResource[]? - List of returned users
scim: UserSearch
Represents the request body of userSearch operation.
Fields
- schemas string[](default ["urn:ietf:params:scim:api:messages:2.0:SearchRequest"]) - URIs of the used SCIM schemas
- attributes string[]? - List of attributes to search for
- excludedAttributes string[]? - Names of resource attributes to be removed from the default set of attributes to return
- filter string? - Filter expression
- domain string? - Domain name
- startIndex int? - Starting index of the result set
- count int? - Number of results returned
- sortBy string? - Attribute used to order the returned responses
- sortOrder string? - order in which the sortBy parameter is applied
scim: UserUpdate
Represents the request of updateUser operation.
Fields
- externalId string? - Identifier by the provisioning client
- userName string? - Unique identifier within the system
- name Name? - Components of the user's name
- displayName string? - Name displayed to end-users
- nickName string? - Casual name of the user
- profileUrl string? - URI of the user's online profile
- emails Email[]? - Email addresses for the User
- addresses Address[]? - Physical mailing address for the user
- phoneNumbers Phone[]? - Phone numbers for the user
- ims Ims[]? - Instant messaging addresses for the user
- roles Role[]? - List of roles for the user
- photos Photo[]? - URI of image of the user
- entitlements Entitlement[]? - List of entitlements for the user
- userType string? - Relationship between the organization and the user
- title string? - Title of the user
- preferredLanguage string? - Preferred written or spoken languages of the user
- locale string? - Default location of the user
- timezone string? - Time zone of the user
- active boolean? - Administrative status of the user
- x509Certificates Certificate[]? - Certificates associated with the user
- meta Meta? - Metadata of the user
- urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2\.0\:User SCIMEnterpriseUser? - Attributes belong to business or enterprise extension schema
Errors
scim: ErrorResponse
Import
import ballerinax/scim;
Metadata
Released date: 22 days ago
Version: 0.1.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
Pull count
Total: 1442
Current verison: 41
Weekly downloads
Other versions
0.1.1
0.1.0