Class ScimShaper

java.lang.Object
org.mockserver.scim.ScimShaper

public class ScimShaper extends Object
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.

  • Field Details

  • 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: ensures schemas contains the resource's core schema, ensures id is present, and injects/refreshes meta.
      Parameters:
      stored - the raw stored resource (already carries the persisted id)
      type - the resource type (User/Group)
      publicBaseUrl - scheme+authority for the meta.location (may be empty/null)
      basePath - the provider base path (e.g. /scim/v2)
      created - true when 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 include
      totalResults - 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 description
      scimType - the SCIM detail error keyword (may be null, e.g. for 401/404/500)