SCIM Resource Type, Service Provider, and Schema Basics
Liferay DXP 2025.Q2+
Liferay provides a headless API to query the SCIM resource types, service providers, and schemas available. Use the /scim
endpoint from the API Explorer to explore the available APIs.
Retrieving the Resource Types
Start a new Liferay DXP instance by running
docker run -it -m 8g -p 8080:8080 liferay/dxp:2025.q1.6-lts
Sign in to Liferay at http://localhost:8080 using the email address test@liferay.com and the password test. When prompted, change the password to learn.
Once Liferay is running,
-
Download and unzip SCIM Resource Type and Schema Basics.
curl https://resources.learn.liferay.com/examples/liferay-s7r9.zip -O
unzip liferay-s7r9.zip
-
Use the cURL script to query for the resource types in Liferay. On the command line, navigate to the
curl
folder. Execute theResourceTypes_GET.sh
script.
./ResourceTypes_GET.sh
The JSON response shows the available resource types:
{
"startIndex": 1,
"totalResults": 2,
"itemsPerPage": 2,
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"Resources": [
{
"schema": "urn:ietf:params:scim:schemas:core:2.0:Group",
"endpoint": "/Groups",
"meta": {
"location": "http://localhost:8080/o/scim/v1.0/v2/ResourceTypes/Group",
"resourceType": "ResourceType"
},
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:ResourceType"
],
"name": "Group",
"description": "https://datatracker.ietf.org/doc/html/rfc7643#section-8.7.1",
"id": "Group"
},
{
"schema": "urn:ietf:params:scim:schemas:core:2.0:User",
"endpoint": "/Users",
"meta": {
"location": "http://localhost:8080/o/scim/v1.0/v2/ResourceTypes/User",
"resourceType": "ResourceType"
},
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:ResourceType"
],
"name": "User",
"description": "https://datatracker.ietf.org/doc/html/rfc7643#section-8.7.1",
"schemaExtensions": [
{
"schema": "urn:ietf:params:scim:schemas:extension:liferay:2.0:User",
"required": false
}
],
"id": "User"
}
]
}
-
Alternatively, call the REST service using the Java client. Navigate into the
java
folder and compile the source files:javac -classpath .:* *.java
-
Run the
ResourceTypes_GET
class.java -classpath .:* ResourcTypes_GET
Examine the cURL Command
The ResourceTypes_GET.sh
script calls the REST service with a cURL command.
curl \
'http://localhost:8080/o/scim/v1.0/v2/ResourceTypes' \
--user "test@liferay.com:learn"
Here are the command’s arguments:
Arguments | Description |
---|---|
"http://localhost:8080/o/scim/v1.0/v2/ResourceTypes" | The REST service endpoint |
--user "test@liferay.com:learn" | Basic authentication credentials |
Examine the Java Class
The ResourceType_GET.java
class queries the server for the supported resource types by calling the ResourceTypesResource
service.
This class invokes the REST service using only three lines of code:
Line (abbreviated) | Description |
---|---|
ResourceTypesResource.Builder builder = ... | Get a Builder for generating a ResourceTypesResource service instance. |
ResourceTypesResource resourceTypesResource = builder.authentication(...).build(); | Use basic authentication and generate a ResourceTypesResource service instance. |
resourceTypesResource.getV2ResourceTypes() | Call the resourceTypesResource.getV2ResourceTypes() method. |
Note that the project includes the com.liferay.scim.rest.client.jar
file as a dependency. You can find client JAR dependency information for all REST applications in the API explorer in your installation at /o/api
(e.g., http://localhost:8080/o/api).
The main
method’s comment demonstrates running the class.
See ResourceTypesResource for service details.
Schemas_GET.sh
This service gets the available SCIM schemas from the server.
Command:
./Schemas_GET.sh
Code:
curl \
"http://localhost:8080/o/scim/v1.0/v2/Schemas" \
--user "test@liferay.com:learn"
Schemas_GET.java
Command:
java -classpath .:* Schemas_GET
Code:
SchemaResource.Builder builder = SchemaResource.builder();
SchemaResource schemaResource = builder.authentication(
"test@liferay.com", "learn"
).build();
System.out.println(schemaResource.getV2Schemas());
}
The Schema
objects from your Liferay instance appear in JSON.
ServiceProviderConfig_GET.sh
This service gets information about Liferay’s SCIM implementation.
Command:
./ServiceProviderConfig_GET.sh
Code:
curl \
"http://localhost:8080/o/scim/v1.0/v2/ServiceProviderConfig" \
--user "test@liferay.com:learn"
ServiceProviderConfig_GET.java
Command:
java -classpath .:* ServiceProviderConfig_GET
Code: