Pass all search information into the repository implementation

This change is backward compatible, but it's possible this should be a breaking change, and force implementations to use this method, instead of the other?
When developer overrides this method, the original `find` method must still be defined, but is not used.

Questions:
-  I'm not really a fan of the FindRequest nameing, `SearchRequest` or `QueryRequest` might work better, but `SearchRequest` is used at the REST layer, so I didn't thing we should have two classes named `SearchRequest` (maybe we should rename the other...)
- Backwards compatibilty, should we break this? (the migration guide would be simple)
- Passing the exclude args down the the search is probably the right thing to do, but that potentially changes the meaning of the etag,  this is currently done at the REST layer, but maybe this should move down a layer?  We could still handle this by default 🤷

We probably need to dig into how the etag should work when attributes are included/excluded
3 files changed
tree: 3e7247393c32391889fc9520bd1950b48bb31da4
  1. .github/
  2. .mvn/
  3. scim-client/
  4. scim-compliance-tests/
  5. scim-core/
  6. scim-coverage/
  7. scim-server/
  8. scim-server-examples/
  9. scim-spec/
  10. scim-tools/
  11. src/
  12. support/
  13. .asf.yaml
  14. .editorconfig
  15. .gitignore
  16. Dockerfile
  17. LICENSE
  18. lombok.config
  19. mvnw
  20. mvnw.cmd
  21. NOTICE
  22. pom.xml
  23. README.md
README.md

License

Apache Directory SCIMple

Jakarta EE implementation of the Simple Cross-domain Identity Management (SCIM) version 2.0 specification as defined by the following RFCs:

Project

Please fork this project and contribute Pull-Requests via this project's Github page. Issue tracking is being transitioned to the Apache Foundation's Jira server.

Please visit our project page at https://directory.apache.org/scimple.

Features

  • A full-featured Java SCIM client
  • Declarative creation of new ResourceTypes and Extensions
  • Dynamic generation of the Schema and ResourceType end-points.
  • A suite of tools to allow the creation of SCIM resources that can then be verified against the appropriate schemas.

Future features

  • Example implementations of the server with various persistence paradigms.
  • A set of verification tests to ensure the project meets the specification and to allow inter-operability testing.

Example code

Examples of the project's declarative syntax are shown below. The first example shows how a SCIM resource is declared:

@Data
@EqualsAndHashCode(callSuper = true)
@ScimResourceType(
    id = ScimUser.RESOURCE_NAME,
    name = ScimUser.RESOURCE_NAME,
    schema = ScimUser.SCHEMA_URI,
    description = "Top level ScimUser",
    endpoint = "/Users"
)
@XmlRootElement(name = ScimUser.RESOURCE_NAME)
@XmlAccessorType(XmlAccessType.FIELD)
public class ScimUser extends ScimResource {

    public static final String RESOURCE_NAME = "User";
    public static final String SCHEMA_URI = "urn:ietf:params:scim:schemas:core:2.0:User";

    @ScimAttribute(
    description="A Boolean value indicating the User's administrative status.",
    type=Type.BOOLEAN
    )
    
    @XmlElement(name = "active")
    Boolean active = true;

    @ScimAttribute(
    type = Type.COMPLEX,
    description="A physical mailing address for this User, as described in (address Element). Canonical Type Values of work, home, and other. The value attribute is a complex type with the following sub-attributes."
    )
    @XmlElement(name = "addresses")
    List<Address> addresses;

In the example above, annotations are used at the class level and member level to declare a new SCIM resource and its attributes respectively. The example below shows the equivalent declaration for a resource Extension:

@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ScimExtensionType(
    required = false,
    name = "EnterpriseUser",
    id = EnterpriseExtension.URN,
    description = "Attributes commonly used in representing users that belong to, or act on behalf of, a business or enterprise."
)
@Data
public class EnterpriseExtension implements ScimExtension {

    public static final String URN = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";

    @XmlType
    @XmlAccessorType(XmlAccessType.NONE)
    @Data
    @Accessors(chain = true)
    public static class Manager {

        @ScimAttribute(
        description = "The \"id\" of the SCIM resource representing the user's manager.  RECOMMENDED."
        )
    
        @XmlElement
        private String value;

        @ScimAttribute(
        description = "The URI of the SCIM resource representing the User's manager.  RECOMMENDED."
        )
        
        @XmlElement
        private String $ref;

This example shows how an extension is declared at the class level, but also provides an example of how complex SCIM types can be simply defined as suitably annotated inner classes.

Implementations are fully customizable without altering the core server code. The example below shows how the implementation for a repository is declared:

public class InMemoryUserService implements Respository<ScimUser> {

Implementing the repository interface allows the customization of create, retrieve, update, and delete methods (as well as find). Customization is flexible - if your system implements soft deletes, create a delete method that simply sets a flag and alter the find and retrieve methods to only return “undeleted” resources.

Building & Contributing

Clone the code and build it!

Prerequisites

  • Java 17+

NOTE: The build runs with Java 17+, but compiles to Java 11.

git clone https://github.com/apache/directory-scimple.git
cd directory-scimple
./mvnw package
# or on windows
# mvnw.bat package

Project modules

NameDescription
scim-spec/scim-spec-schemaSCIM relate models from RFC7643 and Filter related models from RFC7644
scim-spec/scim-spec-protocolAll other REST related models from RFC7644
scim-clientA SCIM REST Client
scim-coreSCIMple Repository related classes, used to provide CRUD operations to a data store (e.g. a database), see above example
scim-serverREST Endpoint implementations
scim-server-examplesVarious server examples
scim-compliance-testsIntegration tests that can be used to test a SCIM server