-
Notifications
You must be signed in to change notification settings - Fork 37
Define a new endpoint
This page provides a simple example how a new endpoint may be registered in the ResourceEndpoint
instance.
At first you need to define a resource-type that gives all relevant information for the endpoint:
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:ResourceType"
],
"id": "Role",
"name": "Role",
"description": "Access Role",
"schema": "urn:gold:params:scim:schemas:custom:2.0:Role",
"endpoint": "/Roles",
"schemaExtensions": [
{
"schema": "urn:gold:params:scim:schemas:custom:2.0:RoleExtension",
"required": true
}
]
}
I would recommend to also define a meta-attribute within resource-types and schemas. Otherwise the meta attributes are created implicitly during startup changing its values after each startup
This example defines an endpoint for the resource named "Role" defined in the schema with the id "urn:gold:params:scim:schemas:custom:2.0:Role" that has a mandatory schema extension that is defined in the schema with the id "urn:gold:params:scim:schemas:custom:2.0:RoleExtension". So if this resource type is registered in the ResourceEndpoint
instance you will also need to register the two schemas with the given ids:
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Schema"
],
"id": "urn:gold:params:scim:schemas:custom:2.0:Role",
"name": "Role",
"description": "Access Role",
"attributes": [
{
"name": "id",
"type": "string",
"description": "Unique identifier for the SCIM Resource as defined by the Service Provider.",
"mutability": "readOnly",
"returned": "always",
"uniqueness": "none",
"multiValued": false,
"required": true,
"caseExact": true
},
{
"name": "externalId",
"type": "string",
"description": "A String that is an identifier for the resource as defined by the provisioning client.The service provider MUST always interpret the externalId as scoped to the provisioning domain.",
"mutability": "readWrite",
"returned": "default",
"uniqueness": "none",
"multiValued": false,
"required": false,
"caseExact": true
},
{
"name": "displayName",
"type": "string",
"description": "A human-readable name for the Role. REQUIRED.",
"mutability": "readWrite",
"returned": "default",
"uniqueness": "none",
"multiValued": false,
"required": true,
"caseExact": false
}
]
}
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Schema"
],
"id": "urn:gold:params:scim:schemas:custom:2.0:RoleExtension",
"name": "RoleExtension",
"description": "Role extension",
"attributes": [
{
"name": "parentId",
"type": "string",
"description": "test",
"mutability": "readOnly",
"returned": "always",
"uniqueness": "none",
"multiValued": false,
"required": true,
"caseExact": true
}
]
}
With this your are good to go. This will define a new endpoint in the ResourceEndpoint
instance. All you have to do is to create an EndpointDefinition
instance that receives these json documents as parameters as well as an implementation that extends ResourceHandler
. Afterwards you should call: resourceEndpoint.registerEndpoint(roleEndpoint)
.