Package org.mockserver.scim
Class ScimShaper
java.lang.Object
org.mockserver.scim.ScimShaper
Shapes raw stored resources into SCIM 2.0 wire representations and builds the SCIM envelopes
(ListResponse and Error). Responsible for injecting the
schemas, id, and
meta attributes every SCIM resource must carry.
SCIM responses use the application/scim+json media type and a small set of well-known
schema URNs defined in RFC 7643/7644.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe two SCIM resource types served by this provider, expressed as the singular resource name used in URLs (Users,Groups) mapped to its core schema URN. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ObjectNodeBuilds a SCIM Error envelope.com.fasterxml.jackson.databind.node.ObjectNodelistResponse(List<com.fasterxml.jackson.databind.node.ObjectNode> resources, int totalResults, int startIndex) Builds a SCIM ListResponse envelope around the supplied (already shaped) resources.com.fasterxml.jackson.databind.node.ObjectNodeshapeResource(com.fasterxml.jackson.databind.node.ObjectNode stored, ScimShaper.ResourceType type, String publicBaseUrl, String basePath, boolean created) Shapes a stored resource into its SCIM wire form: ensuresschemascontains the resource's core schema, ensuresidis present, and injects/refreshesmeta.
-
Field Details
-
CONTENT_TYPE
- See Also:
-
USER_SCHEMA
- See Also:
-
GROUP_SCHEMA
- See Also:
-
LIST_RESPONSE_SCHEMA
- See Also:
-
ERROR_SCHEMA
- See Also:
-
PATCH_OP_SCHEMA
- See Also:
-
SERVICE_PROVIDER_CONFIG_SCHEMA
- See Also:
-
-
Constructor Details
-
ScimShaper
public ScimShaper()
-
-
Method Details
-
shapeResource
public com.fasterxml.jackson.databind.node.ObjectNode shapeResource(com.fasterxml.jackson.databind.node.ObjectNode stored, ScimShaper.ResourceType type, String publicBaseUrl, String basePath, boolean created) Shapes a stored resource into its SCIM wire form: ensuresschemascontains the resource's core schema, ensuresidis present, and injects/refreshesmeta.- Parameters:
stored- the raw stored resource (already carries the persistedid)type- the resource type (User/Group)publicBaseUrl- scheme+authority for themeta.location(may be empty/null)basePath- the provider base path (e.g./scim/v2)created-truewhen this is a freshly created resource (sets meta.created)- Returns:
- a new shaped
ObjectNode(the input is not mutated)
-
listResponse
public com.fasterxml.jackson.databind.node.ObjectNode listResponse(List<com.fasterxml.jackson.databind.node.ObjectNode> resources, int totalResults, int startIndex) Builds a SCIM ListResponse envelope around the supplied (already shaped) resources.- Parameters:
resources- the page of resources to includetotalResults- total number of matching resources (before pagination)startIndex- 1-based index of the first resource in this page
-
error
public com.fasterxml.jackson.databind.node.ObjectNode error(int status, String detail, String scimType) Builds a SCIM Error envelope.- Parameters:
status- the HTTP status code (as a string, per RFC 7644)detail- a human-readable descriptionscimType- the SCIM detail error keyword (may be null, e.g. for 401/404/500)
-