Class ScimServiceProvider

java.lang.Object
com.revetsec.scim.ScimServiceProvider

@Immutable @CheckReturnValue public final class ScimServiceProvider extends Object
Immutable framework-neutral SCIM schema, request and response primitives. Applications authenticate, authorize, execute queries and persist candidates atomically; this facade performs no I/O. Each direct-result operation has one bounded work budget and redacted observer lifecycle. Parsed carriers are tied to this registration and compatibility snapshot. Base-URI-only copies share that semantic registration; changed compatibility requires fresh parsing. Resource-type arguments must be the exact immutable objects registered with this provider, rather than separately constructed equal definitions. Passing a foreign trusted type is a programming error; expected untrusted-input failures return checked fixed rejections. Original query/header occurrences must reach these operations before framework normalization. A prepared response proves bounded output only. Applications prepare the final authorized candidate before commit where preparation can fail, then emit it only after confirmed persistence.
Since:
1.0.0
  • Method Details

    • builder

      Starts configuration with no resource registrations; PATCH, filter, sort and password-change advertisement are disabled, and ETags are enabled. The application still owns password authorization and handling for a supplied write-only password value.
      Returns:
      a new builder
      Since:
      1.0.0
    • copy

      Starts a copy retaining the current semantic registration unless compatibility changes.
      Returns:
      a new copier
      Since:
      1.0.0
    • getBaseUri

      Returns the trusted canonical trailing-slash base URI.
      Returns:
      the trusted canonical trailing-slash base URI
      Since:
      1.0.0
    • getResourceTypes

      Returns the immutable registered resource types.
      Returns:
      the immutable registered resource types
      Since:
      1.0.0
    • getServiceProviderConfig

      Returns the advertised capabilities.
      Returns:
      the advertised capabilities
      Since:
      1.0.0
    • getLimits

      Returns the processing limits.
      Returns:
      the processing limits
      Since:
      1.0.0
    • getCompatibility

      Returns the explicit compatibility features.
      Returns:
      the explicit compatibility features
      Since:
      1.0.0
    • getStringMatching

      Returns the optional application matching strategy.
      Returns:
      the optional application matching strategy
      Since:
      1.0.0
    • getFilterPolicies

      Returns the immutable configured filter policies.
      Returns:
      the immutable configured filter policies
      Since:
      1.0.0
    • validateContentTypeResult

      Validates exactly one original physical media-type header occurrence. Accepts application/scim+json or application/json with the selected syntactically valid charset accommodation. Bodies remain strictly UTF-8 regardless of a charset label. Missing, duplicate, malformed or unsupported values reject; do not join physical occurrences before validation.
      Parameters:
      rawHeaderValues - original physical Content-Type values, including an empty list when absent
      Returns:
      the checked direct result
      Since:
      1.0.0
    • parseFilterResult

      Parses, binds and approves the complete normalized filter under the configured policy. Syntax alone grants no query permission. Applications execute the returned tree and separately authorize the caller and tenant; this operation executes no storage query.
      Parameters:
      resourceType - the exact registered resource-type object
      expression - the complete untrusted filter expression
      Returns:
      the checked direct result
      Since:
      1.0.0
    • parseQueryResult

      Parses a raw GET collection query with strict bounded decoding and complete filter approval. Preserve physical repeated fields; do not first pass through a framework parameter map. Raw plus means space and percent escapes are decoded strictly. Applications own execution, authorization and cursor authenticity/context binding.
      Parameters:
      resourceType - the exact registered resource-type object
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      the checked direct result
      Since:
      1.0.0
    • parseAttributeSelectionResult

      Parses a bound projection from the original raw query, separately from caller authorization. Preserve physical repeated fields and undecoded text before framework parameter normalization. The returned selection retains this provider's semantic registration.
      Parameters:
      resourceType - the exact registered resource-type object
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      the checked direct result
      Since:
      1.0.0
    • checkIfMatchResult

      Checks weak opaque-version If-Match against the existing resource, deliberately differing from general HTTP strong comparison. Absence succeeds; an isolated wildcard tests existence. Applications check this exact authoritative resource under the write's lock/version predicate.
      Parameters:
      rawHeaderValues - original physical If-Match values, or an empty list when absent
      current - the authoritative existing resource from that transaction
      Returns:
      the checked direct result
      Since:
      1.0.0
    • checkIfNoneMatchResult

      Checks original conditional-read tags against the authoritative existing resource using weak opaque-version comparison. Absence proceeds; an isolated wildcard can report NotModified without a version. Applications own the corresponding GET/HEAD route and read consistency.
      Parameters:
      rawHeaderValues - original physical If-None-Match values, or an empty list when absent
      current - the authoritative existing resource
      Returns:
      the checked direct result
      Since:
      1.0.0
    • parseSearchRequestResult

      public @NonNull ScimQueryParseResult parseSearchRequestResult(@NonNull ScimResourceType resourceType, @NonNull List<@NonNull String> contentTypeHeaderValues, byte @NonNull [] body)
      Parses a search body after validating original media-type fields.
      Parameters:
      resourceType - the exact registered resource-type object
      contentTypeHeaderValues - original physical media-type occurrences
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parseSearchRequestResult

      Parses a search body whose HTTP framing and media type were already validated.
      Parameters:
      resourceType - the exact registered resource-type object
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parseResourceResult

      public @NonNull ScimResourceParseResult parseResourceResult(@NonNull ScimResourceType resourceType, @NonNull List<@NonNull String> contentTypeHeaderValues, byte @NonNull [] body)
      Parses a create body after validating original media-type fields.
      Parameters:
      resourceType - the exact registered resource-type object
      contentTypeHeaderValues - original physical media-type occurrences
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parseResourceResult

      Parses a create body whose HTTP framing and media type were already validated.
      Parameters:
      resourceType - the exact registered resource-type object
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parseReplacementResult

      Parses a replace body after validating original media-type fields.
      Parameters:
      resourceType - the exact registered resource-type object
      current - the immutable authoritative current resource
      contentTypeHeaderValues - original physical media-type occurrences
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parseReplacementResult

      Parses a replace body whose HTTP framing and media type were already validated.
      Parameters:
      resourceType - the exact registered resource-type object
      current - the immutable authoritative current resource
      body - untrusted UTF-8 JSON; empty bytes reject
      Returns:
      a checked candidate or fixed error
      Since:
      1.0.0
    • parsePatchRequestResult

      public @NonNull ScimPatchParseResult parsePatchRequestResult(@NonNull ScimResourceType resourceType, @NonNull List<@NonNull String> contentTypeHeaderValues, byte @NonNull [] body)
      Parses ordered PATCH operations after validating original media-type fields.
      Parameters:
      resourceType - the exact registered resource-type object
      contentTypeHeaderValues - original physical media-type occurrences
      body - untrusted UTF-8 PatchOp JSON; empty bytes reject
      Returns:
      a schema-bound request or fixed error
      Since:
      1.0.0
    • parsePatchRequestResult

      Parses PATCH bytes whose transport framing and media type were already validated.
      Parameters:
      resourceType - the exact registered resource-type object
      body - untrusted UTF-8 PatchOp JSON; empty bytes reject
      Returns:
      a schema-bound request or fixed error
      Since:
      1.0.0
    • applyPatchResult

      Applies every ordered operation to an immutable candidate, publishing only after final validation. Applications authorize attempted and effective paths and persist the candidate atomically.
      Parameters:
      current - authoritative resource from the application's transaction
      patch - schema-bound request from this semantic registration
      Returns:
      a complete candidate with change/provenance paths or fixed error
      Since:
      1.0.0
    • reduceMembershipPatchResult

      Reduces supported standard Group membership operations into ordered ID steps without reading storage. Metadata-dependent operations require full evaluation. The application executes all steps and the remainder under one authorization decision and transaction/version predicate.
      Parameters:
      patch - schema-bound request from this semantic registration
      Returns:
      ordered steps, full-evaluation requirement or fixed error
      Since:
      1.0.0
    • resourceLocationFor

      public @NonNull URI resourceLocationFor(@NonNull ScimResourceType resourceType, @NonNull String authoritativeId)
      Encodes an authoritative ID as one path segment beneath the trusted type endpoint. ASCII letters, digits and -._~ remain literal; other UTF-8 bytes use uppercase percent escapes. Standalone . and .. identifiers are rejected before encoding. Existing percent escapes in the opaque ID are data, not instructions to decode.
      Parameters:
      resourceType - the exact registered resource-type object
      authoritativeId - application-assigned identifier
      Returns:
      an absolute resource location
      Since:
      1.0.0
    • resourceResponseResult

      Prepares a GET resource response without write provenance.
      Parameters:
      resource - resource to render
      selection - bound projection
      Returns:
      a bounded prepared response or fixed error
      Since:
      1.0.0
    • replacementResponseResult

      Prepares a replacement response from the final authorized candidate with authoritative metadata. Prepare before commit where preparation can fail, and emit only after confirmed persistence. Supplied paths are trusted application provenance from parsing, separately from attempted or modified authorization targets. The bare set has no private parser/configuration proof; its paths are validated against the target schema. Preparation proves neither authorization nor persistence.
      Parameters:
      replaced - the final application-assigned replacement candidate
      suppliedPaths - canonical paths actually supplied, from the resource parse result
      selection - the bound projection from this semantic registration
      Returns:
      a bounded prepared response or fixed error
      Since:
      1.0.0
    • createdResponseResult

      Prepares creation from the final authorized candidate with authoritative ID and metadata. Location comes from the trusted base/type endpoint, and any existing meta.location must agree. Prepare before commit where preparation can fail, and emit only after confirmed persistence. Supplied paths are trusted application provenance from parsing, not attempted/modified targets. The bare set has no private parser/configuration proof; its paths are checked against the target schema. Preparation proves neither authorization nor persistence.
      Parameters:
      created - the final application-assigned creation candidate with an assigned ID
      suppliedPaths - canonical paths actually supplied, from the resource parse result
      selection - the bound projection from this semantic registration
      Returns:
      a bounded prepared response or fixed error
      Since:
      1.0.0
    • patchResponseResult

      Prepares the final authorized PATCH candidate after application-assigned authoritative metadata. Prepare before commit where preparation can fail, and emit only after confirmed persistence. The resource type's default is used unless either projection parameter was supplied, which forces status 200. Bodyless responses retain authoritative ETag and bounded headers. Supplied paths are trusted application provenance from PATCH application, not attempted/modified authorization targets. The bare set has no private parser/configuration proof; its paths are checked against the target schema. Preparation proves neither authorization nor persistence.
      Parameters:
      persistedCandidate - the final application-assigned candidate; persistence need not precede preparation
      suppliedPaths - canonical paths actually supplied, from the PATCH application result
      selection - the bound response projection from this semantic registration
      Returns:
      a bounded prepared response or fixed error
      Since:
      1.0.0
    • listResponseResult

      Prepares a truthful index or cursor ListResponse from an application-produced page.
      Parameters:
      page - checked page and its originating query
      Returns:
      a bounded prepared response or fixed error
      Since:
      1.0.0
    • serviceProviderConfigResponseResult

      Prepares bounded discovery with projection; discovery filters reject.
      Parameters:
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      discovery or a fixed error
      Since:
      1.0.0
    • resourceTypesResponseResult

      Prepares bounded discovery with projection; discovery filters reject.
      Parameters:
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      discovery or a fixed error
      Since:
      1.0.0
    • resourceTypeResponseResult

      Prepares bounded discovery with projection; discovery filters reject.
      Parameters:
      resourceTypeName - registered case-exact type name
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      discovery or a fixed error
      Since:
      1.0.0
    • schemasResponseResult

      Prepares bounded discovery with projection; discovery filters reject.
      Parameters:
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      discovery or a fixed error
      Since:
      1.0.0
    • schemaResponseResult

      Prepares bounded discovery with projection; discovery filters reject.
      Parameters:
      schemaId - registered schema identifier
      rawQuery - the original undecoded query without a leading question mark, or empty when absent
      Returns:
      discovery or a fixed error
      Since:
      1.0.0
    • noContentResponse

      Returns the fixed bounded no-content response.
      Returns:
      a bodyless 204 response
      Since:
      1.0.0
    • notModifiedResponseResult

      Prepares a bounded bodyless conditional read response with current ETag when enabled.
      Parameters:
      current - authoritative existing resource
      Returns:
      a bounded 304 response or fixed error
      Since:
      1.0.0
    • errorResponse

      Returns a fixed bounded error without including request data or causes.
      Parameters:
      error - fixed core error
      Returns:
      an error response
      Since:
      1.0.0
    • toString

      Returns a fixed redacted description.
      Overrides:
      toString in class Object
      Returns:
      a redacted description
      Since:
      1.0.0