protected boolean createUserResource(final Principal principal, final Credential credential,
                                         final Optional<RegisteredService> registeredService) {
        val user = mapper.forCreate(principal, credential);
        LOGGER.trace("Creating user resource [{}]", user);
        val scimRequestBuilder = getScimRequestBuilder(registeredService);
        val createdResult = createUser(scimRequestBuilder, user);
        if (createdResult.isPresent()) {
            val createdUser = createdResult.get();
            val groupsToCreateOrUpdate = mapper.forGroups(principal, createdUser);
            groupsToCreateOrUpdate
                .stream()
                .parallel()
                .forEach(group -> createOrUpdateGroups(scimRequestBuilder, group));
        }
        return createdResult.isPresent();
    }
This is {@link ScimPrincipalProvisioner}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-scim-core/src/main/java/org/apereo/cas/scim/v2/provisioning/ScimPrincipalProvisioner.java