private void addCustomApplicationRelatedFiles(String bucket, ShareResourcesRequest request) {
        List<String> filesFromRequest = request.getResources().stream()
                .map(SharedResource::getUrl).toList();
        Config config = configStore.get();
        Set<SharedResource> newSharedResources = new HashSet<>(request.getResources());
        for (SharedResource sharedResource : request.getResources()) {
            ResourceDescriptor resource = getResourceFromLink(sharedResource.getUrl());
            if (resource.getType() == ResourceTypes.APPLICATION) {
                Application application = applicationService.getApplication(resource).getValue();
                List<ResourceDescriptor> files = ApplicationTypeSchemaUtils.getFiles(config, application, encryptionService, resourceService);
                for (ResourceDescriptor file : files) {
                    if (file.isPublic() || !file.getBucketName().equals(bucket)) {
                        throw new IllegalArgumentException("All files in the application %s should belong to a requester".formatted(resource.getUrl()));
                    }
                    if (!filesFromRequest.contains(file.getUrl())) {
                        newSharedResources.add(new SharedResource(file.getUrl(), sharedResource.getPermissions()));
                    }
                }
            }
        }
        request.setResources(newSharedResources);
    }
Returns list of resources shared by user.

@param bucket   - user bucket
@param location - storage location
@param request  - request body
@return list of shared with user resources
server/src/main/java/com/epam/aidial/core/server/service/ShareService.java