UnboundID SCIM 2 SDK for Java

repository·master·Indexed 42 days ago

https://github.com/pingidentity/scim2

A Java-based toolkit for building SCIM 2.0 compliant client and server applications. It provides robust models, filtering, and request handling capabilities, including full support for PATCH, bulk operations, and cursor-based pagination. The SDK includes modules for common models, JAX-RS clients and servers, and experimental Ping Identity specific extensions.

Tokens
2.4K
Snippets
4
Records
8
Agent score
3%

What's inside UnboundID SCIM 2 SDK

  1. Overview of the UnboundID SCIM 2 SDK for Java

    master
    The UnboundID SCIM 2 SDK for Java is a toolkit for building applications and servers that interact with SCIM (System for Cross-domain Identity Management) service providers. It is designed to facilitate interoperability with SCIM-compliant services, including the Ping Identity Directory Server.
  2. Overview of UnboundID SCIM 2 SDK for Java

    master

    The UnboundID SCIM 2 SDK is an open-source Java library designed to help developers build applications that interface with the SCIM (System for Cross-domain Identity Management) 2.0 protocol. It provides a foundation for both SCIM clients and servers, supporting sensitive user data management, filtering, request handling, and error response generation.

    Key features include:

    • Full support for SCIM 2.0 (PATCH, filters, bulk operations, cursor-based pagination).
    • Jackson-based API for easy CRUD operations.
    • Explicit nullability documentation via @NotNull and @Nullable annotations.
    • Support for both POJO-based models and generic JSON tree models (GenericScimResource).
    • Extensible framework for custom resource types.
    • Compatibility with JVM languages like Kotlin and Scala.
  3. Use SCIM 2 SDK UnboundID Extensions for proprietary features

    master

    The scim2-ubid-extensions component provides model classes that represent UnboundID-proprietary extensions to the SCIM standard. These classes allow you to work with non-standard SCIM attributes and structures used by UnboundID products, such as the Ping Identity Directory Server.

    Warning: This component is considered experimental. Its API, structure, and contents are subject to change without notice.

  4. SDK Module Structure and Selection Guide

    master

    The SDK is divided into several modules depending on your use case:

    ModulePurposeTarget Audience
    scim2-sdk-commonCore SCIM model classes, parsers, filter, and PATCH processing.Developers needing models, utilities, or standalone SCIM support.
    scim2-sdk-clientClasses for creating SCIM 2 client applications using JAX-RS.SCIM client developers using JAX-RS.
    scim2-sdk-serverClasses for creating SCIM 2 service providers using JAX-RS.SCIM service developers using JAX-RS. (Note: Spring users should use common instead).
    scim2-ubid-extensionsPing Identity specific extensions to the SCIM standard.Developers using Ping Identity service features (Experimental).
    scim2-parentAggregator module containing all dependencies.Anyone needing the full suite of modules.
  5. Understand nullability annotations in the SCIM 2 SDK

    master

    The SCIM 2 SDK uses JSR-305 style annotations to explicitly define the nullability of inputs, member variables, and return values. This helps prevent NullPointerException errors and provides better integration with languages like Kotlin or IDE-based static analysis tools.

    Key annotations used:

    • com.unboundid.scim2.common.annotations.Nullable: Indicates that a value can be null.
    • com.unboundid.scim2.common.annotations.NotNull: Indicates that a value must not be null.

    You can leverage these annotations in your IDE (such as IntelliJ IDEA or Eclipse) to enable automatic validation and warnings when interacting with the SDK.

    @NotNull
    public UserResource setUserName(@Nullable final String userName);
  6. Use ScimService to interact with a SCIM provider

    master

    For client applications, the ScimService class is the primary entry point. It wraps a JAX-RS client and provides high-level methods for CRUD operations, partial updates (PATCH), and searching. You can interact with resources using strongly-typed POJOs (like UserResource) or via the GenericScimResource for flexible JSON manipulation.

    import com.unboundid.scim2.client.ScimService;
    import com.unboundid.scim2.common.exceptions.ScimException;
    import com.unboundid.scim2.common.types.UserResource;
    import com.unboundid.scim2.common.types.Name;
    import com.unboundid.scim2.common.types.Email;
    import com.unboundid.scim2.common.GenericScimResource;
    import com.unboundid.scim2.common.messages.ListResponse;
    import com.unboundid.scim2.common.filters.Filter;
    
    // Create a ScimService.
    Client client = ClientBuilder.newClient()
        .register(OAuth2ClientSupport.feature("..bearerToken.."));
    WebTarget target = client.target("https://example.com/scim/v2");
    ScimService scimService = new ScimService(target);
    
    // Create a user with a POST request by calling create().
    UserResource user = new UserResource()
        .setUserName("babs")
        .setPassword("secret");
    user.setName(new Name()
        .setGivenName("Barbara")
        .setFamilyName("Jensen")
    );
    user.setEmails(new Email()
        .setType("home")
        .setPrimary(true)
        .setValue("babs@example.com")
    );
    user = scimService.create("Users", user);
    
    // Retrieve the latest version of the user as a UserResource, and
    // update/replace it with a PUT request.
    user = scimService.retrieve("Users", user.getId(), UserResource.class);
    user.setDisplayName("Babs");
    user = scimService.replace(user);
    
    // Retrieve the user as a GenericScimResource and update/replace it with a PUT
    // request.
    GenericScimResource genericUser =
        scimService.retrieve("Users", user.getId(), GenericScimResource.class);
    genericUser.replace("displayName", "Babs Jensen");
    genericUser = scimService.replaceRequest(genericUser).invoke();
    
    // Perform a partial modification of the user with a PATCH request.
    scimService.modifyRequest("Users", user.getId())
        .replaceValue("displayName", "Babs")
        .invoke(GenericScimResource.class);
    
    // Perform a password change with a PATCH request.
    scimService.modifyRequest("Users", user.getId())
        .replaceValue("password", "new-password")
        .invoke(GenericScimResource.class);
    
    // Search for users with the same last name as our user. Fetch the first page
    // of results, which should have a maximum of five resources on the page.
    // The service should only return the value of the "name" attribute.
    ListResponse<UserResource> searchResponse =
        scimService.searchRequest("Users")
            .filter(Filter.eq("name.familyName", user.getName().getFamilyName()))
            .page(1, 5)
            .attributes("name")
            .invoke(UserResource.class);
  7. Build the SDK from source

    master

    The project uses Maven. You can build the source code using the Maven Wrapper (mvnw).

    Linux or Mac:

    ./mvnw clean package

    Windows:

    mvnw.cmd clean package

    To skip Checkstyle validation during the build, use the -Dcheckstyle.skip=true flag.

    # Linux or Mac
    ./mvnw clean package
    
    # Windows
    mvnw.cmd clean package
  8. Install the SCIM 2 SDK via Maven

    master

    The SDK is available on Maven Central. To include the core SCIM models and utilities in your project, add the scim2-sdk-common dependency to your pom.xml. Ensure you replace ${scim2.sdk.version} with the latest available version.

    <dependency>
      <groupId>com.unboundid.product.scim2</groupId>
      <artifactId>scim2-sdk-common</artifactId>
      <version>${scim2.sdk.version}</version>
    </dependency>