From 495b2f21f63367a0345cafef418994158d75fb77 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Mon, 1 Jul 2024 12:36:53 +0100 Subject: [PATCH 1/5] Renamed Classes: Corrected imports by renaming class files to fit correct name used when referenced --- .../DefaultCMSEncryptionModule.java | 4 +-- .../directory/DefaultCredentialsModule.java | 20 ++++++------ .../directory/DefaultKeystoreCacheModule.java | 4 +-- .../impl/directory/DefaultProfileModule.java | 32 +++++++++---------- .../impl/document/DefaultDocumentModule.java | 8 ++--- .../actions/DefaultInboxActionsModule.java | 20 ++++++------ .../impl/keystore/DefaultKeyStoreModule.java | 8 ++--- .../DefaultPathEncryptionModule.java | 12 +++---- .../actions/DefaultPrivateActionsModule.java | 24 +++++++------- .../DefaultVersionedPrivateActionsModule.java | 32 +++++++++---------- .../profile/keys/DefaultKeyStoreCache.java | 3 +- .../impl/profile/HardcodedProfileModule.java | 12 +++---- 12 files changed, 90 insertions(+), 89 deletions(-) diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java index ec94bfba2..7fba886cb 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java @@ -6,7 +6,7 @@ import de.adorsys.datasafe.encrypiton.api.cmsencryption.CMSEncryptionService; import de.adorsys.datasafe.encrypiton.api.types.encryption.CmsEncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; -import de.adorsys.datasafe.encrypiton.impl.cmsencryption.CMSEncryptionServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.cmsencryption.CMSEncryptionServiceImpl; import javax.annotation.Nullable; @@ -32,5 +32,5 @@ static CmsEncryptionConfig cmsEncryptionConfig(@Nullable EncryptionConfig config * Default BouncyCastle based CMS encryption for document. */ @Binds - abstract CMSEncryptionService cmsEncryptionService(CMSEncryptionServiceImplRuntimeDelegatable impl); + abstract CMSEncryptionService cmsEncryptionService(CMSEncryptionServiceImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java index 6d132913a..c60c11fc7 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java @@ -7,11 +7,11 @@ import de.adorsys.datasafe.directory.api.profile.keys.PrivateKeyService; import de.adorsys.datasafe.directory.api.profile.keys.PublicKeyService; import de.adorsys.datasafe.directory.api.profile.keys.StorageKeyStoreOperations; -import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.keys.DFSPrivateKeyServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.keys.DFSPublicKeyServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.keys.DocumentKeyStoreOperationsImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.keys.StorageKeyStoreOperationsImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.keys.DFSPrivateKeyServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.keys.DFSPublicKeyServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.keys.DocumentKeyStoreOperationsImpl; +import de.adorsys.datasafe.directory.impl.profile.keys.StorageKeyStoreOperationsImpl; /** * This module is responsible for credentials access - either user or dfs. @@ -23,30 +23,30 @@ public abstract class DefaultCredentialsModule { * Default no-op service to get credentials to access filesystem. */ @Binds - abstract BucketAccessService bucketAccessService(BucketAccessServiceImplRuntimeDelegatable impl); + abstract BucketAccessService bucketAccessService(BucketAccessServiceImpl impl); /** * Default public key service that reads user public keys from the location specified by his profile inside DFS. */ @Binds - abstract PublicKeyService publicKeyService(DFSPublicKeyServiceImplRuntimeDelegatable impl); + abstract PublicKeyService publicKeyService(DFSPublicKeyServiceImpl impl); /** * Keystore(document) operations class that hides keystore access from other components. */ @Binds - abstract DocumentKeyStoreOperations docKeyStoreOperations(DocumentKeyStoreOperationsImplRuntimeDelegatable impl); + abstract DocumentKeyStoreOperations docKeyStoreOperations(DocumentKeyStoreOperationsImpl impl); /** * Keystore(storage credentials) operations class that hides keystore access from other components. */ @Binds - abstract StorageKeyStoreOperations storageKeyStoreOperations(StorageKeyStoreOperationsImplRuntimeDelegatable impl); + abstract StorageKeyStoreOperations storageKeyStoreOperations(StorageKeyStoreOperationsImpl impl); /** * Default private key service that reads user private/secret keys from the location specified by his * profile inside DFS. */ @Binds - abstract PrivateKeyService privateKeyService(DFSPrivateKeyServiceImplRuntimeDelegatable impl); + abstract PrivateKeyService privateKeyService(DFSPrivateKeyServiceImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java index 309a10ed8..9c7e56c65 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java @@ -4,7 +4,7 @@ import com.google.common.cache.CacheBuilder; import dagger.Module; import dagger.Provides; -import de.adorsys.datasafe.directory.impl.profile.keys.DefaultKeyStoreCacheRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.keys.DefaultKeyStoreCache; import de.adorsys.datasafe.directory.impl.profile.keys.KeyStoreCache; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.keystore.PublicKeyIDWithPublicKey; @@ -42,7 +42,7 @@ static KeyStoreCache keyStoreCache(@Nullable OverridesRegistry registry) { .expireAfterWrite(60, TimeUnit.MINUTES) .build(); - return new DefaultKeyStoreCacheRuntimeDelegatable( + return new DefaultKeyStoreCache( registry, cachePubKeys.get().asMap(), cacheKeystore.get().asMap(), diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java index 129a63abe..c7590786a 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java @@ -14,15 +14,15 @@ import de.adorsys.datasafe.directory.api.resource.ResourceResolver; import de.adorsys.datasafe.directory.api.types.UserPrivateProfile; import de.adorsys.datasafe.directory.api.types.UserPublicProfile; -import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.DefaultUserProfileCacheRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.DefaultUserProfileCache; import de.adorsys.datasafe.directory.impl.profile.operations.UserProfileCache; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRegistrationServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRemovalServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRetrievalServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileUpdatingServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRegistrationServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRemovalServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRetrievalServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileUpdatingServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImpl; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.KeyCreationConfig; @@ -63,7 +63,7 @@ static UserProfileCache userProfileCache(@Nullable OverridesRegistry registry) { .expireAfterWrite(15, TimeUnit.MINUTES) .build(); - return new DefaultUserProfileCacheRuntimeDelegatable( + return new DefaultUserProfileCache( registry, publicProfileCache.asMap(), privateProfileCache.asMap() @@ -74,41 +74,41 @@ static UserProfileCache userProfileCache(@Nullable OverridesRegistry registry) { * Default profile reading service that simply reads json files with serialized public/private located on DFS. */ @Binds - abstract ProfileRetrievalService profileRetrievalService(ProfileRetrievalServiceImplRuntimeDelegatable impl); + abstract ProfileRetrievalService profileRetrievalService(ProfileRetrievalServiceImpl impl); /** * Default profile creation service that simply creates keystore, public keys, user profile json files on DFS. */ @Binds - abstract ProfileRegistrationService creationService(ProfileRegistrationServiceImplRuntimeDelegatable impl); + abstract ProfileRegistrationService creationService(ProfileRegistrationServiceImpl impl); /** * Default profile updating service. */ @Binds - abstract ProfileUpdatingService updatingService(ProfileUpdatingServiceImplRuntimeDelegatable impl); + abstract ProfileUpdatingService updatingService(ProfileUpdatingServiceImpl impl); /** * Default profile removal service. */ @Binds - abstract ProfileRemovalService removalService(ProfileRemovalServiceImplRuntimeDelegatable impl); + abstract ProfileRemovalService removalService(ProfileRemovalServiceImpl impl); /** * Storage credentials access. */ @Binds - abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImplRuntimeDelegatable impl); + abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImpl impl); /** * Resource resolver that simply prepends relevant path segment from profile based on location type. */ @Binds - abstract ResourceResolver resourceResolver(ResourceResolverImplRuntimeDelegatable impl); + abstract ResourceResolver resourceResolver(ResourceResolverImpl impl); /** * Aggregate service for profile operations. */ @Binds - abstract ProfileOperations profileService(DFSBasedProfileStorageImplRuntimeDelegatable impl); + abstract ProfileOperations profileService(DFSBasedProfileStorageImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java index ab8f2472a..79067ed0e 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java @@ -4,8 +4,8 @@ import dagger.Module; import de.adorsys.datasafe.encrypiton.api.document.EncryptedDocumentReadService; import de.adorsys.datasafe.encrypiton.api.document.EncryptedDocumentWriteService; -import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentReadServiceRuntimeDelegatable; -import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentWriteServiceRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentReadService; +import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentWriteService; /** * This module is responsible for document storage (example: which pathencryption to use) and listing bucket content. @@ -17,11 +17,11 @@ public abstract class DefaultDocumentModule { * By default, encrypt document using CMS-encryption provided by BouncyCastle. */ @Binds - abstract EncryptedDocumentReadService documentReadService(CMSDocumentReadServiceRuntimeDelegatable impl); + abstract EncryptedDocumentReadService documentReadService(CMSDocumentReadService impl); /** * By default, decrypt document using CMS-encryption provided by BouncyCastle. */ @Binds - abstract EncryptedDocumentWriteService documentWriteService(CMSDocumentWriteServiceRuntimeDelegatable impl); + abstract EncryptedDocumentWriteService documentWriteService(CMSDocumentWriteService impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java index d6778f394..7e73d02d8 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java @@ -7,11 +7,11 @@ import de.adorsys.datasafe.inbox.api.actions.ReadFromInbox; import de.adorsys.datasafe.inbox.api.actions.RemoveFromInbox; import de.adorsys.datasafe.inbox.api.actions.WriteToInbox; -import de.adorsys.datasafe.inbox.impl.InboxServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.inbox.impl.actions.ListInboxImplRuntimeDelegatable; -import de.adorsys.datasafe.inbox.impl.actions.ReadFromInboxImplRuntimeDelegatable; -import de.adorsys.datasafe.inbox.impl.actions.RemoveFromInboxImplRuntimeDelegatable; -import de.adorsys.datasafe.inbox.impl.actions.WriteToInboxImplRuntimeDelegatable; +import de.adorsys.datasafe.inbox.impl.InboxServiceImpl; +import de.adorsys.datasafe.inbox.impl.actions.ListInboxImpl; +import de.adorsys.datasafe.inbox.impl.actions.ReadFromInboxImpl; +import de.adorsys.datasafe.inbox.impl.actions.RemoveFromInboxImpl; +import de.adorsys.datasafe.inbox.impl.actions.WriteToInboxImpl; /** * This module is responsible for providing default actions on INBOX folder. Paths are not encrypted in INBOX. @@ -23,30 +23,30 @@ public abstract class DefaultInboxActionsModule { * By default, lists files in users' INBOX location on DFS (privatespace access required). */ @Binds - abstract ListInbox listInbox(ListInboxImplRuntimeDelegatable impl); + abstract ListInbox listInbox(ListInboxImpl impl); /** * By default, reads and decrypts file (using private key) from users' INBOX location on DFS * (privatespace access required). */ @Binds - abstract ReadFromInbox readInbox(ReadFromInboxImplRuntimeDelegatable impl); + abstract ReadFromInbox readInbox(ReadFromInboxImpl impl); /** * By default, writes file into users' INBOX using his public key (no privatespace access required). */ @Binds - abstract WriteToInbox writeInbox(WriteToInboxImplRuntimeDelegatable impl); + abstract WriteToInbox writeInbox(WriteToInboxImpl impl); /** * By default, deletes file from users' INBOX location on DFS (privatespace access required). */ @Binds - abstract RemoveFromInbox removeFromInbox(RemoveFromInboxImplRuntimeDelegatable impl); + abstract RemoveFromInbox removeFromInbox(RemoveFromInboxImpl impl); /** * Aggregate view of operations that can be done on INBOX. */ @Binds - abstract InboxService inboxService(InboxServiceImplRuntimeDelegatable impl); + abstract InboxService inboxService(InboxServiceImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java index 8c3bb3745..62555634a 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java @@ -6,8 +6,8 @@ import de.adorsys.datasafe.encrypiton.api.keystore.KeyStoreService; import de.adorsys.datasafe.encrypiton.api.keystore.PublicKeySerde; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; -import de.adorsys.datasafe.encrypiton.impl.keystore.KeyStoreServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.encrypiton.impl.keystore.PublicKeySerdeImplRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.keystore.KeyStoreServiceImpl; +import de.adorsys.datasafe.encrypiton.impl.keystore.PublicKeySerdeImpl; import de.adorsys.keymanagement.api.Juggler; import de.adorsys.keymanagement.api.config.keystore.KeyStoreConfig; import de.adorsys.keymanagement.juggler.services.DaggerBCJuggler; @@ -44,12 +44,12 @@ static Juggler juggler(KeyStoreConfig config) { * Default public key serializer. */ @Binds - public abstract PublicKeySerde publicKeySerde(PublicKeySerdeImplRuntimeDelegatable impl); + public abstract PublicKeySerde publicKeySerde(PublicKeySerdeImpl impl); /** * If no external configuration provided ({@link KeyStoreConfig}), BouncyCastle BCFKS key store type is * used by default. */ @Binds - public abstract KeyStoreService keyStoreService(KeyStoreServiceImplRuntimeDelegatable impl); + public abstract KeyStoreService keyStoreService(KeyStoreServiceImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java index edf00c01e..e8bbf2c94 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java @@ -5,10 +5,10 @@ import dagger.Provides; import de.adorsys.datasafe.encrypiton.api.pathencryption.PathEncryption; import de.adorsys.datasafe.encrypiton.api.pathencryption.encryption.SymmetricPathEncryptionService; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.IntegrityPreservingUriEncryptionRuntimeDelegatable; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptionImplRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.IntegrityPreservingUriEncryption; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptionImpl; import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptorDecryptor; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathSegmentEncryptorDecryptorRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathSegmentEncryptorDecryptor; import org.cryptomator.siv.SivMode; /** @@ -30,7 +30,7 @@ static SivMode sivMode() { * Default path encryption that uses Base64-urlsafe path serialization and AES-CGM-SIV mode for encryption */ @Binds - abstract PathEncryptorDecryptor pathEncryptorDecryptor(PathSegmentEncryptorDecryptorRuntimeDelegatable impl); + abstract PathEncryptorDecryptor pathEncryptorDecryptor(PathSegmentEncryptorDecryptor impl); /** * By default simply use @@ -38,11 +38,11 @@ static SivMode sivMode() { * and pass path with key to {@link SymmetricPathEncryptionService} */ @Binds - abstract PathEncryption pathEncryption(PathEncryptionImplRuntimeDelegatable impl); + abstract PathEncryption pathEncryption(PathEncryptionImpl impl); /** * Default symmetric path encryption that encrypts URI segment-by-segment. */ @Binds - abstract SymmetricPathEncryptionService symmetricPathEncryptionService(IntegrityPreservingUriEncryptionRuntimeDelegatable impl); + abstract SymmetricPathEncryptionService symmetricPathEncryptionService(IntegrityPreservingUriEncryption impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java index 52a2cf500..36dd4629c 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java @@ -8,12 +8,12 @@ import de.adorsys.datasafe.privatestore.api.actions.ReadFromPrivate; import de.adorsys.datasafe.privatestore.api.actions.RemoveFromPrivate; import de.adorsys.datasafe.privatestore.api.actions.WriteToPrivate; -import de.adorsys.datasafe.privatestore.impl.PrivateSpaceServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.privatestore.impl.actions.EncryptedResourceResolverImplRuntimeDelegatable; -import de.adorsys.datasafe.privatestore.impl.actions.ListPrivateImplRuntimeDelegatable; -import de.adorsys.datasafe.privatestore.impl.actions.ReadFromPrivateImplRuntimeDelegatable; -import de.adorsys.datasafe.privatestore.impl.actions.RemoveFromPrivateImplRuntimeDelegatable; -import de.adorsys.datasafe.privatestore.impl.actions.WriteToPrivateImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.PrivateSpaceServiceImpl; +import de.adorsys.datasafe.privatestore.impl.actions.EncryptedResourceResolverImpl; +import de.adorsys.datasafe.privatestore.impl.actions.ListPrivateImpl; +import de.adorsys.datasafe.privatestore.impl.actions.ReadFromPrivateImpl; +import de.adorsys.datasafe.privatestore.impl.actions.RemoveFromPrivateImpl; +import de.adorsys.datasafe.privatestore.impl.actions.WriteToPrivateImpl; /** * This module is responsible for providing default actions on PRIVATE folder. @@ -25,36 +25,36 @@ public abstract class DefaultPrivateActionsModule { * By default encrypts URI of the document and resolves its absolute location against PRIVATE folder. */ @Binds - abstract EncryptedResourceResolver encryptedResourceResolver(EncryptedResourceResolverImplRuntimeDelegatable impl); + abstract EncryptedResourceResolver encryptedResourceResolver(EncryptedResourceResolverImpl impl); /** * Lists files in PRIVATE folder, also provides decrypted path of the document. */ @Binds - abstract ListPrivate listPrivate(ListPrivateImplRuntimeDelegatable impl); + abstract ListPrivate listPrivate(ListPrivateImpl impl); /** * Reads and decrypts file from private folder using secret key. */ @Binds - abstract ReadFromPrivate readFromPrivate(ReadFromPrivateImplRuntimeDelegatable impl); + abstract ReadFromPrivate readFromPrivate(ReadFromPrivateImpl impl); /** * Writes and encrypts file to private folder using secret key (also document URI is encrypted using * {@link EncryptedResourceResolver}). */ @Binds - abstract WriteToPrivate writeToPrivate(WriteToPrivateImplRuntimeDelegatable impl); + abstract WriteToPrivate writeToPrivate(WriteToPrivateImpl impl); /** * Removes file from user private storage. */ @Binds - abstract RemoveFromPrivate removeFromPrivate(RemoveFromPrivateImplRuntimeDelegatable impl); + abstract RemoveFromPrivate removeFromPrivate(RemoveFromPrivateImpl impl); /** * Aggregate view of operations that can be done on privatespace. */ @Binds - abstract PrivateSpaceService privateSpaceService(PrivateSpaceServiceImplRuntimeDelegatable impl); + abstract PrivateSpaceService privateSpaceService(PrivateSpaceServiceImpl impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java index 131516704..b2342378d 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java @@ -11,14 +11,14 @@ import de.adorsys.datasafe.metainfo.version.api.version.VersionInfoService; import de.adorsys.datasafe.metainfo.version.api.version.VersionedPrivateSpaceService; import de.adorsys.datasafe.metainfo.version.impl.version.VersionEncoderDecoder; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionEncoderDecoderRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionInfoServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.EncryptedLatestLinkServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.LatestPrivateSpaceImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestListImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestReadImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestRemoveImplRuntimeDelegatable; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestWriteImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionEncoderDecoder; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionInfoServiceImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.EncryptedLatestLinkServiceImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.LatestPrivateSpaceImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestListImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestReadImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestRemoveImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestWriteImpl; import de.adorsys.datasafe.metainfo.version.impl.version.types.DFSVersion; import de.adorsys.datasafe.metainfo.version.impl.version.types.LatestDFSVersion; @@ -41,50 +41,50 @@ static LatestDFSVersion latestDFSVersion() { * Encode version into URL, by default http://example.com/path is encoded to http://example.com/path/VERSION */ @Binds - abstract VersionEncoderDecoder versionEncoder(DefaultVersionEncoderDecoderRuntimeDelegatable impl); + abstract VersionEncoderDecoder versionEncoder(DefaultVersionEncoderDecoder impl); /** * Lists all resource versions. */ @Binds - abstract VersionInfoService versionInfoService(DefaultVersionInfoServiceImplRuntimeDelegatable impl); + abstract VersionInfoService versionInfoService(DefaultVersionInfoServiceImpl impl); /** * Resolver that locates latest document link and reads it. */ @Binds - abstract EncryptedLatestLinkService latestLink(EncryptedLatestLinkServiceImplRuntimeDelegatable impl); + abstract EncryptedLatestLinkService latestLink(EncryptedLatestLinkServiceImpl impl); /** * Lists only latest files in users' privatespace. */ @Binds - abstract VersionedList latestList(LatestListImplRuntimeDelegatable impl); + abstract VersionedList latestList(LatestListImpl impl); /** * Reads latest blob associated with the resource. */ @Binds - abstract VersionedRead latestRead(LatestReadImplRuntimeDelegatable impl); + abstract VersionedRead latestRead(LatestReadImpl impl); /** * Removes link to latest blob, so it won't get listed. */ @Binds - abstract VersionedRemove latestRemove(LatestRemoveImplRuntimeDelegatable impl); + abstract VersionedRemove latestRemove(LatestRemoveImpl impl); /** * Writes blob and updates the latest link, so that it points to written blob (creates a version of * the document that automatically should become the latest). */ @Binds - abstract VersionedWrite latestWrite(LatestWriteImplRuntimeDelegatable impl); + abstract VersionedWrite latestWrite(LatestWriteImpl impl); /** * Aggregate view of operations on latest files in privatespace. */ @Binds abstract VersionedPrivateSpaceService versionVersionedPrivateSpaceService( - LatestPrivateSpaceImplRuntimeDelegatable impl + LatestPrivateSpaceImpl impl ); } diff --git a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java index ea48714ec..947fc02b7 100644 --- a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java +++ b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java @@ -3,6 +3,7 @@ import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.keystore.PublicKeyIDWithPublicKey; import de.adorsys.datasafe.types.api.context.annotations.RuntimeDelegate; +import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; import lombok.Getter; import javax.inject.Inject; @@ -23,7 +24,7 @@ public class DefaultKeyStoreCache implements KeyStoreCache { @Inject public DefaultKeyStoreCache( - Map> publicKeys, + OverridesRegistry registry, Map> publicKeys, Map keystore, Map storageAccess) { this.publicKeys = publicKeys; diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java b/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java index 2cf4fceb2..68f032fc1 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java +++ b/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java @@ -10,9 +10,9 @@ import de.adorsys.datasafe.directory.api.profile.operations.ProfileStorageCredentialsService; import de.adorsys.datasafe.directory.api.profile.operations.ProfileUpdatingService; import de.adorsys.datasafe.directory.api.resource.ResourceResolver; -import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImplRuntimeDelegatable; -import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImpl; +import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImpl; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.KeyCreationConfig; @@ -58,17 +58,17 @@ static KeyCreationConfig cmsEncryptionConfig(@Nullable EncryptionConfig config) * Storage credentials access. */ @Binds - abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImplRuntimeDelegatable impl); + abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImpl impl); /** * Resource resolver that simply prepends relevant path segment from profile based on location type. */ @Binds - abstract ResourceResolver resourceResolver(ResourceResolverImplRuntimeDelegatable impl); + abstract ResourceResolver resourceResolver(ResourceResolverImpl impl); /** * Aggregate service for profile operations. */ @Binds - abstract ProfileOperations profileService(DFSBasedProfileStorageImplRuntimeDelegatable impl); + abstract ProfileOperations profileService(DFSBasedProfileStorageImpl impl); } From 941e9a390fdbdd7ea7e9919904576c339c2e01e1 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Mon, 1 Jul 2024 12:38:22 +0100 Subject: [PATCH 2/5] Renamed Classes: Corrected imports by renaming class files to fit correct name used when referenced --- .../impl/profile/operations/DefaultUserProfileCache.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java index 07876e94c..aea40521e 100644 --- a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java +++ b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java @@ -4,6 +4,7 @@ import de.adorsys.datasafe.directory.api.types.UserPublicProfile; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.types.api.context.annotations.RuntimeDelegate; +import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; import lombok.Getter; import javax.inject.Inject; @@ -20,7 +21,7 @@ public class DefaultUserProfileCache implements UserProfileCache { private final Map privateProfile; @Inject - public DefaultUserProfileCache(Map publicProfile, + public DefaultUserProfileCache(OverridesRegistry registry, Map publicProfile, Map privateProfile) { this.publicProfile = publicProfile; this.privateProfile = privateProfile; From bebbee884281bdcc1561e6aafa34de180c9071c6 Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Mon, 1 Jul 2024 12:58:42 +0100 Subject: [PATCH 3/5] Modified file in datasafe-rest-impl to enhance security with the REST APIs --- .../controller/AuthenticateController.java | 3 +- .../impl/controller/DocumentController.java | 46 ++++++++++++++----- .../rest/impl/controller/InboxController.java | 26 ++++++----- .../rest/impl/controller/UserController.java | 35 +++++++------- .../impl/controller/VersionController.java | 29 ++++++------ 5 files changed, 84 insertions(+), 55 deletions(-) diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/AuthenticateController.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/AuthenticateController.java index 59f79c43c..a876601d8 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/AuthenticateController.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/AuthenticateController.java @@ -15,6 +15,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -31,7 +32,7 @@ public class AuthenticateController { private final AuthenticationManager authenticationManager; @PostMapping(SecurityConstants.AUTH_LOGIN_URL) - public void authenticate(@RequestBody UserDTO credentialsDTO, HttpServletResponse response) { + public void authenticate(@RequestBody @Validated UserDTO credentialsDTO, HttpServletResponse response) { String username = credentialsDTO.getUserName(); String password = credentialsDTO.getPassword(); UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/DocumentController.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/DocumentController.java index d28e74c07..6c1209207 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/DocumentController.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/DocumentController.java @@ -12,6 +12,8 @@ import de.adorsys.datasafe.types.api.resource.PrivateResource; import de.adorsys.datasafe.types.api.resource.StorageIdentifier; import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -49,11 +51,16 @@ public class DocumentController { */ @SneakyThrows @GetMapping(value = "/document/{*path}", produces = APPLICATION_OCTET_STREAM_VALUE) - public void readDocument(@RequestHeader String user, - @RequestHeader String password, + public void readDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable String path, + @PathVariable @NotBlank String path, HttpServletResponse response) { + // Validate and sanitize path + if (path.contains("..")) { + throw new IllegalArgumentException("Invalid path"); + } + UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); ReadRequest request = ReadRequest.forPrivate(userIDAuth, new StorageIdentifier(storageId), path); @@ -72,11 +79,16 @@ public void readDocument(@RequestHeader String user, */ @SneakyThrows @PutMapping(value = "/document/{*path}", consumes = MULTIPART_FORM_DATA_VALUE) - public void writeDocument(@RequestHeader String user, - @RequestHeader String password, + public void writeDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, @PathVariable String path, - @RequestParam("file") MultipartFile file) { + @RequestParam("file") @NotNull MultipartFile file) { + // Validate and sanitize path + if (path.contains("..")) { + throw new IllegalArgumentException("Invalid path"); + } + UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); WriteRequest request = WriteRequest.forPrivate(userIDAuth, new StorageIdentifier(storageId), path); @@ -91,14 +103,20 @@ public void writeDocument(@RequestHeader String user, * lists files in user's private space. */ @GetMapping("/documents/{*path}") - public List listDocuments(@RequestHeader String user, - @RequestHeader String password, + public List listDocuments(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, @PathVariable(required = false) String path) { UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); path = Optional.ofNullable(path) .map(it -> it.replaceAll("^\\.$", "")) .orElse("./"); + + // Validate and sanitize path + if (path.contains("..")) { + throw new IllegalArgumentException("Invalid path"); + } + try { List documentList = datasafeService.privateService().list( ListRequest.forPrivate(userIDAuth, new StorageIdentifier(storageId), path)) @@ -115,10 +133,16 @@ public List listDocuments(@RequestHeader String user, * deletes files from user's private space. */ @DeleteMapping("/document/{*path}") - public void removeDocument(@RequestHeader String user, - @RequestHeader String password, + public void removeDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable String path) { + @PathVariable @NotBlank String path) { + + // Validate and sanitize path + if (path.contains("..")) { + throw new IllegalArgumentException("Invalid path"); + } + UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); RemoveRequest request = RemoveRequest.forPrivate(userIDAuth, new StorageIdentifier(storageId), path); diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/InboxController.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/InboxController.java index 5f86a1f1b..42ed50988 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/InboxController.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/InboxController.java @@ -12,6 +12,8 @@ import de.adorsys.datasafe.types.api.resource.BasePrivateResource; import de.adorsys.datasafe.types.api.resource.PrivateResource; import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -52,10 +54,10 @@ public class InboxController { */ @SneakyThrows @PutMapping(value = "/inbox/document/{*path}", consumes = MULTIPART_FORM_DATA_VALUE) - public void writeToInbox(@RequestHeader String user, - @RequestHeader String password, - @RequestHeader Set recipients, - @PathVariable String path, + public void writeToInbox(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, + @RequestHeader Set<@NotBlank String> recipients, + @PathVariable @NotBlank String path, @RequestParam("file") MultipartFile file) { UserIDAuth fromUser = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); Set toUsers = recipients.stream().map(UserID::new).collect(Collectors.toSet()); @@ -72,9 +74,9 @@ public void writeToInbox(@RequestHeader String user, */ @SneakyThrows @GetMapping(value = "/inbox/document/{*path}", produces = APPLICATION_OCTET_STREAM_VALUE) - public void readFromInbox(@RequestHeader String user, - @RequestHeader String password, - @PathVariable String path, + public void readFromInbox(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, + @PathVariable @NotBlank String path, HttpServletResponse response) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); @@ -93,9 +95,9 @@ public void readFromInbox(@RequestHeader String user, * Deletes file from users' INBOX. */ @DeleteMapping("/inbox/document/{*path}") - public void deleteFromInbox(@RequestHeader String user, - @RequestHeader String password, - @PathVariable String path) { + public void deleteFromInbox(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, + @PathVariable @NotBlank String path) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); PrivateResource resource = BasePrivateResource.forPrivate(path); @@ -108,8 +110,8 @@ public void deleteFromInbox(@RequestHeader String user, * list files in users' INBOX. */ @GetMapping(value = "/inbox/documents/{*path}", produces = APPLICATION_JSON_VALUE) - public List listInbox(@RequestHeader String user, - @RequestHeader String password, + public List listInbox(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @PathVariable(required = false) String path) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/UserController.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/UserController.java index 5d78aece9..d9f616d73 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/UserController.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/UserController.java @@ -14,6 +14,7 @@ import de.adorsys.datasafe.rest.impl.exceptions.UserExistsException; import de.adorsys.datasafe.types.api.resource.StorageIdentifier; import de.adorsys.datasafe.types.api.types.ReadKeyPassword; +import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -61,8 +62,8 @@ public void createUser(@Validated @RequestBody UserDTO userDTO) { } @PostMapping("/password") - public void changePassword(@RequestHeader String user, - @RequestHeader String password, + public void changePassword(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @Validated @RequestBody NewPasswordDTO newPassword) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); @@ -70,24 +71,24 @@ public void changePassword(@RequestHeader String user, } @GetMapping("/publicProfile") - public UserPublicProfileDTO getPublicProfile(@RequestHeader String user, - @RequestHeader String password) { + public UserPublicProfileDTO getPublicProfile(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); return UserPublicProfileDTO.from(dataSafeService.userProfile().publicProfile(auth.getUserID())); } @GetMapping("/privateProfile") - public UserPrivateProfileDTO getPrivateProfile(@RequestHeader String user, - @RequestHeader String password) { + public UserPrivateProfileDTO getPrivateProfile(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); return UserPrivateProfileDTO.from(dataSafeService.userProfile().privateProfile(auth)); } @PostMapping("/publicProfile") - public void updatePublicProfile(@RequestHeader String user, - @RequestHeader String password, + public void updatePublicProfile(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @Validated @RequestBody UserPublicProfileDTO profileDto) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); @@ -95,8 +96,8 @@ public void updatePublicProfile(@RequestHeader String user, } @PostMapping("/privateProfile") - public void updatePrivateProfile(@RequestHeader String user, - @RequestHeader String password, + public void updatePrivateProfile(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @Validated @RequestBody UserPrivateProfileDTO profileDto) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); @@ -104,8 +105,8 @@ public void updatePrivateProfile(@RequestHeader String user, } @PostMapping("/storages") - public void addStorageCredentials(@RequestHeader String user, - @RequestHeader String password, + public void addStorageCredentials(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @Validated @RequestBody StorageCredsDTO creds) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); @@ -117,9 +118,9 @@ public void addStorageCredentials(@RequestHeader String user, } @DeleteMapping("/storages") - public void removeStorageCredentials(@RequestHeader String user, - @RequestHeader String password, - @RequestHeader String storageId) { + public void removeStorageCredentials(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, + @RequestHeader @NotBlank String storageId) { ReadKeyPassword readKeyPassword = ReadKeyPasswordHelper.getForString(password); UserIDAuth auth = new UserIDAuth(new UserID(user), readKeyPassword); dataSafeService.userProfile().deregisterStorageCredentials(auth, new StorageIdentifier(storageId)); @@ -132,8 +133,8 @@ public void removeStorageCredentials(@RequestHeader String user, * @param password user password. */ @DeleteMapping - public void deleteUser(@RequestHeader String user, - @RequestHeader String password) { + public void deleteUser(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password) { UserIDAuth auth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); if (!dataSafeService.userProfile().userExists(auth.getUserID())) { throw new UserDoesNotExistsException("user '" + auth.getUserID().getValue() + "' does not exists"); diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/VersionController.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/VersionController.java index ac91da98e..cb329260b 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/VersionController.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/VersionController.java @@ -16,6 +16,7 @@ import de.adorsys.datasafe.types.api.resource.StorageIdentifier; import de.adorsys.datasafe.types.api.resource.Versioned; import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -49,10 +50,10 @@ public class VersionController { * lists latest versions of files in user's private space. */ @GetMapping(value = "/versioned/{*path}", produces = APPLICATION_JSON_VALUE) - public List listVersionedDocuments(@RequestHeader String user, - @RequestHeader String password, + public List listVersionedDocuments(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable(required = false) String path) { + @PathVariable(required = false) String path) { UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); path = path.replaceAll("^/", ""); try { @@ -73,10 +74,10 @@ public List listVersionedDocuments(@RequestHeader String user, */ @SneakyThrows @GetMapping(value = "/versioned/{*path}", produces = APPLICATION_OCTET_STREAM_VALUE) - public void readVersionedDocument(@RequestHeader String user, - @RequestHeader String password, + public void readVersionedDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable String path, + @PathVariable @NotBlank String path, HttpServletResponse response) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); @@ -97,10 +98,10 @@ public void readVersionedDocument(@RequestHeader String user, */ @SneakyThrows @PutMapping(value = "/versioned/{*path}", consumes = MULTIPART_FORM_DATA_VALUE) - public void writeVersionedDocument(@RequestHeader String user, - @RequestHeader String password, + public void writeVersionedDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable String path, + @PathVariable @NotBlank String path, @RequestParam("file") MultipartFile file) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); @@ -117,10 +118,10 @@ public void writeVersionedDocument(@RequestHeader String user, * deletes latest version of file from user's private space. */ @DeleteMapping("/versioned/{*path}") - public void deleteVersionedDocument(@RequestHeader String user, - @RequestHeader String password, + public void deleteVersionedDocument(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, - @PathVariable String path) { + @PathVariable @NotBlank String path) { path = path.replaceAll("^/", ""); UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); RemoveRequest request = @@ -133,8 +134,8 @@ public void deleteVersionedDocument(@RequestHeader String user, * list of file versions. */ @GetMapping(value = "/versions/list/{*path}", produces = APPLICATION_JSON_VALUE) - public List versionsOf(@RequestHeader String user, - @RequestHeader String password, + public List versionsOf(@RequestHeader @NotBlank String user, + @RequestHeader @NotBlank String password, @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId, @PathVariable(required = false) String path) { UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); From 47c5307db41e548c69beddb15e572f6059c1a45c Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Mon, 1 Jul 2024 17:02:49 +0100 Subject: [PATCH 4/5] Renamed Classes: returned defaults to changes made in class names --- .../DefaultCMSEncryptionModule.java | 4 +-- .../directory/DefaultCredentialsModule.java | 20 ++++++------ .../directory/DefaultKeystoreCacheModule.java | 4 +-- .../impl/directory/DefaultProfileModule.java | 32 +++++++++---------- .../impl/document/DefaultDocumentModule.java | 8 ++--- .../actions/DefaultInboxActionsModule.java | 20 ++++++------ .../impl/keystore/DefaultKeyStoreModule.java | 8 ++--- .../DefaultPathEncryptionModule.java | 12 +++---- .../actions/DefaultPrivateActionsModule.java | 24 +++++++------- .../DefaultVersionedPrivateActionsModule.java | 32 +++++++++---------- .../profile/keys/DefaultKeyStoreCache.java | 3 +- .../operations/DefaultUserProfileCache.java | 3 +- .../impl/profile/HardcodedProfileModule.java | 12 +++---- 13 files changed, 90 insertions(+), 92 deletions(-) diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java index 7fba886cb..ec94bfba2 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/cmsencryption/DefaultCMSEncryptionModule.java @@ -6,7 +6,7 @@ import de.adorsys.datasafe.encrypiton.api.cmsencryption.CMSEncryptionService; import de.adorsys.datasafe.encrypiton.api.types.encryption.CmsEncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; -import de.adorsys.datasafe.encrypiton.impl.cmsencryption.CMSEncryptionServiceImpl; +import de.adorsys.datasafe.encrypiton.impl.cmsencryption.CMSEncryptionServiceImplRuntimeDelegatable; import javax.annotation.Nullable; @@ -32,5 +32,5 @@ static CmsEncryptionConfig cmsEncryptionConfig(@Nullable EncryptionConfig config * Default BouncyCastle based CMS encryption for document. */ @Binds - abstract CMSEncryptionService cmsEncryptionService(CMSEncryptionServiceImpl impl); + abstract CMSEncryptionService cmsEncryptionService(CMSEncryptionServiceImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java index c60c11fc7..6d132913a 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultCredentialsModule.java @@ -7,11 +7,11 @@ import de.adorsys.datasafe.directory.api.profile.keys.PrivateKeyService; import de.adorsys.datasafe.directory.api.profile.keys.PublicKeyService; import de.adorsys.datasafe.directory.api.profile.keys.StorageKeyStoreOperations; -import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.keys.DFSPrivateKeyServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.keys.DFSPublicKeyServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.keys.DocumentKeyStoreOperationsImpl; -import de.adorsys.datasafe.directory.impl.profile.keys.StorageKeyStoreOperationsImpl; +import de.adorsys.datasafe.directory.impl.profile.dfs.BucketAccessServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.keys.DFSPrivateKeyServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.keys.DFSPublicKeyServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.keys.DocumentKeyStoreOperationsImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.keys.StorageKeyStoreOperationsImplRuntimeDelegatable; /** * This module is responsible for credentials access - either user or dfs. @@ -23,30 +23,30 @@ public abstract class DefaultCredentialsModule { * Default no-op service to get credentials to access filesystem. */ @Binds - abstract BucketAccessService bucketAccessService(BucketAccessServiceImpl impl); + abstract BucketAccessService bucketAccessService(BucketAccessServiceImplRuntimeDelegatable impl); /** * Default public key service that reads user public keys from the location specified by his profile inside DFS. */ @Binds - abstract PublicKeyService publicKeyService(DFSPublicKeyServiceImpl impl); + abstract PublicKeyService publicKeyService(DFSPublicKeyServiceImplRuntimeDelegatable impl); /** * Keystore(document) operations class that hides keystore access from other components. */ @Binds - abstract DocumentKeyStoreOperations docKeyStoreOperations(DocumentKeyStoreOperationsImpl impl); + abstract DocumentKeyStoreOperations docKeyStoreOperations(DocumentKeyStoreOperationsImplRuntimeDelegatable impl); /** * Keystore(storage credentials) operations class that hides keystore access from other components. */ @Binds - abstract StorageKeyStoreOperations storageKeyStoreOperations(StorageKeyStoreOperationsImpl impl); + abstract StorageKeyStoreOperations storageKeyStoreOperations(StorageKeyStoreOperationsImplRuntimeDelegatable impl); /** * Default private key service that reads user private/secret keys from the location specified by his * profile inside DFS. */ @Binds - abstract PrivateKeyService privateKeyService(DFSPrivateKeyServiceImpl impl); + abstract PrivateKeyService privateKeyService(DFSPrivateKeyServiceImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java index 9c7e56c65..309a10ed8 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultKeystoreCacheModule.java @@ -4,7 +4,7 @@ import com.google.common.cache.CacheBuilder; import dagger.Module; import dagger.Provides; -import de.adorsys.datasafe.directory.impl.profile.keys.DefaultKeyStoreCache; +import de.adorsys.datasafe.directory.impl.profile.keys.DefaultKeyStoreCacheRuntimeDelegatable; import de.adorsys.datasafe.directory.impl.profile.keys.KeyStoreCache; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.keystore.PublicKeyIDWithPublicKey; @@ -42,7 +42,7 @@ static KeyStoreCache keyStoreCache(@Nullable OverridesRegistry registry) { .expireAfterWrite(60, TimeUnit.MINUTES) .build(); - return new DefaultKeyStoreCache( + return new DefaultKeyStoreCacheRuntimeDelegatable( registry, cachePubKeys.get().asMap(), cacheKeystore.get().asMap(), diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java index c7590786a..129a63abe 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/directory/DefaultProfileModule.java @@ -14,15 +14,15 @@ import de.adorsys.datasafe.directory.api.resource.ResourceResolver; import de.adorsys.datasafe.directory.api.types.UserPrivateProfile; import de.adorsys.datasafe.directory.api.types.UserPublicProfile; -import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.DefaultUserProfileCache; +import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.DefaultUserProfileCacheRuntimeDelegatable; import de.adorsys.datasafe.directory.impl.profile.operations.UserProfileCache; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRegistrationServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRemovalServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRetrievalServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileUpdatingServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRegistrationServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRemovalServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileRetrievalServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileUpdatingServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImplRuntimeDelegatable; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.KeyCreationConfig; @@ -63,7 +63,7 @@ static UserProfileCache userProfileCache(@Nullable OverridesRegistry registry) { .expireAfterWrite(15, TimeUnit.MINUTES) .build(); - return new DefaultUserProfileCache( + return new DefaultUserProfileCacheRuntimeDelegatable( registry, publicProfileCache.asMap(), privateProfileCache.asMap() @@ -74,41 +74,41 @@ static UserProfileCache userProfileCache(@Nullable OverridesRegistry registry) { * Default profile reading service that simply reads json files with serialized public/private located on DFS. */ @Binds - abstract ProfileRetrievalService profileRetrievalService(ProfileRetrievalServiceImpl impl); + abstract ProfileRetrievalService profileRetrievalService(ProfileRetrievalServiceImplRuntimeDelegatable impl); /** * Default profile creation service that simply creates keystore, public keys, user profile json files on DFS. */ @Binds - abstract ProfileRegistrationService creationService(ProfileRegistrationServiceImpl impl); + abstract ProfileRegistrationService creationService(ProfileRegistrationServiceImplRuntimeDelegatable impl); /** * Default profile updating service. */ @Binds - abstract ProfileUpdatingService updatingService(ProfileUpdatingServiceImpl impl); + abstract ProfileUpdatingService updatingService(ProfileUpdatingServiceImplRuntimeDelegatable impl); /** * Default profile removal service. */ @Binds - abstract ProfileRemovalService removalService(ProfileRemovalServiceImpl impl); + abstract ProfileRemovalService removalService(ProfileRemovalServiceImplRuntimeDelegatable impl); /** * Storage credentials access. */ @Binds - abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImpl impl); + abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImplRuntimeDelegatable impl); /** * Resource resolver that simply prepends relevant path segment from profile based on location type. */ @Binds - abstract ResourceResolver resourceResolver(ResourceResolverImpl impl); + abstract ResourceResolver resourceResolver(ResourceResolverImplRuntimeDelegatable impl); /** * Aggregate service for profile operations. */ @Binds - abstract ProfileOperations profileService(DFSBasedProfileStorageImpl impl); + abstract ProfileOperations profileService(DFSBasedProfileStorageImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java index 79067ed0e..ab8f2472a 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/document/DefaultDocumentModule.java @@ -4,8 +4,8 @@ import dagger.Module; import de.adorsys.datasafe.encrypiton.api.document.EncryptedDocumentReadService; import de.adorsys.datasafe.encrypiton.api.document.EncryptedDocumentWriteService; -import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentReadService; -import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentWriteService; +import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentReadServiceRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.document.CMSDocumentWriteServiceRuntimeDelegatable; /** * This module is responsible for document storage (example: which pathencryption to use) and listing bucket content. @@ -17,11 +17,11 @@ public abstract class DefaultDocumentModule { * By default, encrypt document using CMS-encryption provided by BouncyCastle. */ @Binds - abstract EncryptedDocumentReadService documentReadService(CMSDocumentReadService impl); + abstract EncryptedDocumentReadService documentReadService(CMSDocumentReadServiceRuntimeDelegatable impl); /** * By default, decrypt document using CMS-encryption provided by BouncyCastle. */ @Binds - abstract EncryptedDocumentWriteService documentWriteService(CMSDocumentWriteService impl); + abstract EncryptedDocumentWriteService documentWriteService(CMSDocumentWriteServiceRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java index 7e73d02d8..d6778f394 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/inbox/actions/DefaultInboxActionsModule.java @@ -7,11 +7,11 @@ import de.adorsys.datasafe.inbox.api.actions.ReadFromInbox; import de.adorsys.datasafe.inbox.api.actions.RemoveFromInbox; import de.adorsys.datasafe.inbox.api.actions.WriteToInbox; -import de.adorsys.datasafe.inbox.impl.InboxServiceImpl; -import de.adorsys.datasafe.inbox.impl.actions.ListInboxImpl; -import de.adorsys.datasafe.inbox.impl.actions.ReadFromInboxImpl; -import de.adorsys.datasafe.inbox.impl.actions.RemoveFromInboxImpl; -import de.adorsys.datasafe.inbox.impl.actions.WriteToInboxImpl; +import de.adorsys.datasafe.inbox.impl.InboxServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.inbox.impl.actions.ListInboxImplRuntimeDelegatable; +import de.adorsys.datasafe.inbox.impl.actions.ReadFromInboxImplRuntimeDelegatable; +import de.adorsys.datasafe.inbox.impl.actions.RemoveFromInboxImplRuntimeDelegatable; +import de.adorsys.datasafe.inbox.impl.actions.WriteToInboxImplRuntimeDelegatable; /** * This module is responsible for providing default actions on INBOX folder. Paths are not encrypted in INBOX. @@ -23,30 +23,30 @@ public abstract class DefaultInboxActionsModule { * By default, lists files in users' INBOX location on DFS (privatespace access required). */ @Binds - abstract ListInbox listInbox(ListInboxImpl impl); + abstract ListInbox listInbox(ListInboxImplRuntimeDelegatable impl); /** * By default, reads and decrypts file (using private key) from users' INBOX location on DFS * (privatespace access required). */ @Binds - abstract ReadFromInbox readInbox(ReadFromInboxImpl impl); + abstract ReadFromInbox readInbox(ReadFromInboxImplRuntimeDelegatable impl); /** * By default, writes file into users' INBOX using his public key (no privatespace access required). */ @Binds - abstract WriteToInbox writeInbox(WriteToInboxImpl impl); + abstract WriteToInbox writeInbox(WriteToInboxImplRuntimeDelegatable impl); /** * By default, deletes file from users' INBOX location on DFS (privatespace access required). */ @Binds - abstract RemoveFromInbox removeFromInbox(RemoveFromInboxImpl impl); + abstract RemoveFromInbox removeFromInbox(RemoveFromInboxImplRuntimeDelegatable impl); /** * Aggregate view of operations that can be done on INBOX. */ @Binds - abstract InboxService inboxService(InboxServiceImpl impl); + abstract InboxService inboxService(InboxServiceImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java index 62555634a..8c3bb3745 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/keystore/DefaultKeyStoreModule.java @@ -6,8 +6,8 @@ import de.adorsys.datasafe.encrypiton.api.keystore.KeyStoreService; import de.adorsys.datasafe.encrypiton.api.keystore.PublicKeySerde; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; -import de.adorsys.datasafe.encrypiton.impl.keystore.KeyStoreServiceImpl; -import de.adorsys.datasafe.encrypiton.impl.keystore.PublicKeySerdeImpl; +import de.adorsys.datasafe.encrypiton.impl.keystore.KeyStoreServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.keystore.PublicKeySerdeImplRuntimeDelegatable; import de.adorsys.keymanagement.api.Juggler; import de.adorsys.keymanagement.api.config.keystore.KeyStoreConfig; import de.adorsys.keymanagement.juggler.services.DaggerBCJuggler; @@ -44,12 +44,12 @@ static Juggler juggler(KeyStoreConfig config) { * Default public key serializer. */ @Binds - public abstract PublicKeySerde publicKeySerde(PublicKeySerdeImpl impl); + public abstract PublicKeySerde publicKeySerde(PublicKeySerdeImplRuntimeDelegatable impl); /** * If no external configuration provided ({@link KeyStoreConfig}), BouncyCastle BCFKS key store type is * used by default. */ @Binds - public abstract KeyStoreService keyStoreService(KeyStoreServiceImpl impl); + public abstract KeyStoreService keyStoreService(KeyStoreServiceImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java index e8bbf2c94..edf00c01e 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/pathencryption/DefaultPathEncryptionModule.java @@ -5,10 +5,10 @@ import dagger.Provides; import de.adorsys.datasafe.encrypiton.api.pathencryption.PathEncryption; import de.adorsys.datasafe.encrypiton.api.pathencryption.encryption.SymmetricPathEncryptionService; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.IntegrityPreservingUriEncryption; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptionImpl; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.IntegrityPreservingUriEncryptionRuntimeDelegatable; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptionImplRuntimeDelegatable; import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathEncryptorDecryptor; -import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathSegmentEncryptorDecryptor; +import de.adorsys.datasafe.encrypiton.impl.pathencryption.PathSegmentEncryptorDecryptorRuntimeDelegatable; import org.cryptomator.siv.SivMode; /** @@ -30,7 +30,7 @@ static SivMode sivMode() { * Default path encryption that uses Base64-urlsafe path serialization and AES-CGM-SIV mode for encryption */ @Binds - abstract PathEncryptorDecryptor pathEncryptorDecryptor(PathSegmentEncryptorDecryptor impl); + abstract PathEncryptorDecryptor pathEncryptorDecryptor(PathSegmentEncryptorDecryptorRuntimeDelegatable impl); /** * By default simply use @@ -38,11 +38,11 @@ static SivMode sivMode() { * and pass path with key to {@link SymmetricPathEncryptionService} */ @Binds - abstract PathEncryption pathEncryption(PathEncryptionImpl impl); + abstract PathEncryption pathEncryption(PathEncryptionImplRuntimeDelegatable impl); /** * Default symmetric path encryption that encrypts URI segment-by-segment. */ @Binds - abstract SymmetricPathEncryptionService symmetricPathEncryptionService(IntegrityPreservingUriEncryption impl); + abstract SymmetricPathEncryptionService symmetricPathEncryptionService(IntegrityPreservingUriEncryptionRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java index 36dd4629c..52a2cf500 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultPrivateActionsModule.java @@ -8,12 +8,12 @@ import de.adorsys.datasafe.privatestore.api.actions.ReadFromPrivate; import de.adorsys.datasafe.privatestore.api.actions.RemoveFromPrivate; import de.adorsys.datasafe.privatestore.api.actions.WriteToPrivate; -import de.adorsys.datasafe.privatestore.impl.PrivateSpaceServiceImpl; -import de.adorsys.datasafe.privatestore.impl.actions.EncryptedResourceResolverImpl; -import de.adorsys.datasafe.privatestore.impl.actions.ListPrivateImpl; -import de.adorsys.datasafe.privatestore.impl.actions.ReadFromPrivateImpl; -import de.adorsys.datasafe.privatestore.impl.actions.RemoveFromPrivateImpl; -import de.adorsys.datasafe.privatestore.impl.actions.WriteToPrivateImpl; +import de.adorsys.datasafe.privatestore.impl.PrivateSpaceServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.actions.EncryptedResourceResolverImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.actions.ListPrivateImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.actions.ReadFromPrivateImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.actions.RemoveFromPrivateImplRuntimeDelegatable; +import de.adorsys.datasafe.privatestore.impl.actions.WriteToPrivateImplRuntimeDelegatable; /** * This module is responsible for providing default actions on PRIVATE folder. @@ -25,36 +25,36 @@ public abstract class DefaultPrivateActionsModule { * By default encrypts URI of the document and resolves its absolute location against PRIVATE folder. */ @Binds - abstract EncryptedResourceResolver encryptedResourceResolver(EncryptedResourceResolverImpl impl); + abstract EncryptedResourceResolver encryptedResourceResolver(EncryptedResourceResolverImplRuntimeDelegatable impl); /** * Lists files in PRIVATE folder, also provides decrypted path of the document. */ @Binds - abstract ListPrivate listPrivate(ListPrivateImpl impl); + abstract ListPrivate listPrivate(ListPrivateImplRuntimeDelegatable impl); /** * Reads and decrypts file from private folder using secret key. */ @Binds - abstract ReadFromPrivate readFromPrivate(ReadFromPrivateImpl impl); + abstract ReadFromPrivate readFromPrivate(ReadFromPrivateImplRuntimeDelegatable impl); /** * Writes and encrypts file to private folder using secret key (also document URI is encrypted using * {@link EncryptedResourceResolver}). */ @Binds - abstract WriteToPrivate writeToPrivate(WriteToPrivateImpl impl); + abstract WriteToPrivate writeToPrivate(WriteToPrivateImplRuntimeDelegatable impl); /** * Removes file from user private storage. */ @Binds - abstract RemoveFromPrivate removeFromPrivate(RemoveFromPrivateImpl impl); + abstract RemoveFromPrivate removeFromPrivate(RemoveFromPrivateImplRuntimeDelegatable impl); /** * Aggregate view of operations that can be done on privatespace. */ @Binds - abstract PrivateSpaceService privateSpaceService(PrivateSpaceServiceImpl impl); + abstract PrivateSpaceService privateSpaceService(PrivateSpaceServiceImplRuntimeDelegatable impl); } diff --git a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java index b2342378d..131516704 100644 --- a/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java +++ b/datasafe-business/src/main/java/de/adorsys/datasafe/business/impl/privatestore/actions/DefaultVersionedPrivateActionsModule.java @@ -11,14 +11,14 @@ import de.adorsys.datasafe.metainfo.version.api.version.VersionInfoService; import de.adorsys.datasafe.metainfo.version.api.version.VersionedPrivateSpaceService; import de.adorsys.datasafe.metainfo.version.impl.version.VersionEncoderDecoder; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionEncoderDecoder; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionInfoServiceImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.EncryptedLatestLinkServiceImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.LatestPrivateSpaceImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestListImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestReadImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestRemoveImpl; -import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestWriteImpl; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionEncoderDecoderRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.DefaultVersionInfoServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.EncryptedLatestLinkServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.LatestPrivateSpaceImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestListImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestReadImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestRemoveImplRuntimeDelegatable; +import de.adorsys.datasafe.metainfo.version.impl.version.latest.actions.LatestWriteImplRuntimeDelegatable; import de.adorsys.datasafe.metainfo.version.impl.version.types.DFSVersion; import de.adorsys.datasafe.metainfo.version.impl.version.types.LatestDFSVersion; @@ -41,50 +41,50 @@ static LatestDFSVersion latestDFSVersion() { * Encode version into URL, by default http://example.com/path is encoded to http://example.com/path/VERSION */ @Binds - abstract VersionEncoderDecoder versionEncoder(DefaultVersionEncoderDecoder impl); + abstract VersionEncoderDecoder versionEncoder(DefaultVersionEncoderDecoderRuntimeDelegatable impl); /** * Lists all resource versions. */ @Binds - abstract VersionInfoService versionInfoService(DefaultVersionInfoServiceImpl impl); + abstract VersionInfoService versionInfoService(DefaultVersionInfoServiceImplRuntimeDelegatable impl); /** * Resolver that locates latest document link and reads it. */ @Binds - abstract EncryptedLatestLinkService latestLink(EncryptedLatestLinkServiceImpl impl); + abstract EncryptedLatestLinkService latestLink(EncryptedLatestLinkServiceImplRuntimeDelegatable impl); /** * Lists only latest files in users' privatespace. */ @Binds - abstract VersionedList latestList(LatestListImpl impl); + abstract VersionedList latestList(LatestListImplRuntimeDelegatable impl); /** * Reads latest blob associated with the resource. */ @Binds - abstract VersionedRead latestRead(LatestReadImpl impl); + abstract VersionedRead latestRead(LatestReadImplRuntimeDelegatable impl); /** * Removes link to latest blob, so it won't get listed. */ @Binds - abstract VersionedRemove latestRemove(LatestRemoveImpl impl); + abstract VersionedRemove latestRemove(LatestRemoveImplRuntimeDelegatable impl); /** * Writes blob and updates the latest link, so that it points to written blob (creates a version of * the document that automatically should become the latest). */ @Binds - abstract VersionedWrite latestWrite(LatestWriteImpl impl); + abstract VersionedWrite latestWrite(LatestWriteImplRuntimeDelegatable impl); /** * Aggregate view of operations on latest files in privatespace. */ @Binds abstract VersionedPrivateSpaceService versionVersionedPrivateSpaceService( - LatestPrivateSpaceImpl impl + LatestPrivateSpaceImplRuntimeDelegatable impl ); } diff --git a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java index 947fc02b7..ea48714ec 100644 --- a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java +++ b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DefaultKeyStoreCache.java @@ -3,7 +3,6 @@ import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.encrypiton.api.types.keystore.PublicKeyIDWithPublicKey; import de.adorsys.datasafe.types.api.context.annotations.RuntimeDelegate; -import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; import lombok.Getter; import javax.inject.Inject; @@ -24,7 +23,7 @@ public class DefaultKeyStoreCache implements KeyStoreCache { @Inject public DefaultKeyStoreCache( - OverridesRegistry registry, Map> publicKeys, + Map> publicKeys, Map keystore, Map storageAccess) { this.publicKeys = publicKeys; diff --git a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java index aea40521e..07876e94c 100644 --- a/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java +++ b/datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/DefaultUserProfileCache.java @@ -4,7 +4,6 @@ import de.adorsys.datasafe.directory.api.types.UserPublicProfile; import de.adorsys.datasafe.encrypiton.api.types.UserID; import de.adorsys.datasafe.types.api.context.annotations.RuntimeDelegate; -import de.adorsys.datasafe.types.api.context.overrides.OverridesRegistry; import lombok.Getter; import javax.inject.Inject; @@ -21,7 +20,7 @@ public class DefaultUserProfileCache implements UserProfileCache { private final Map privateProfile; @Inject - public DefaultUserProfileCache(OverridesRegistry registry, Map publicProfile, + public DefaultUserProfileCache(Map publicProfile, Map privateProfile) { this.publicProfile = publicProfile; this.privateProfile = privateProfile; diff --git a/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java b/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java index 68f032fc1..2cf4fceb2 100644 --- a/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java +++ b/datasafe-simple-adapter/datasafe-simple-adapter-impl/src/main/java/de/adorsys/datasafe/simple/adapter/impl/profile/HardcodedProfileModule.java @@ -10,9 +10,9 @@ import de.adorsys.datasafe.directory.api.profile.operations.ProfileStorageCredentialsService; import de.adorsys.datasafe.directory.api.profile.operations.ProfileUpdatingService; import de.adorsys.datasafe.directory.api.resource.ResourceResolver; -import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImpl; -import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImpl; -import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImpl; +import de.adorsys.datasafe.directory.impl.profile.operations.DFSBasedProfileStorageImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.operations.actions.ProfileStorageCredentialsServiceImplRuntimeDelegatable; +import de.adorsys.datasafe.directory.impl.profile.resource.ResourceResolverImplRuntimeDelegatable; import de.adorsys.datasafe.encrypiton.api.types.encryption.EncryptionConfig; import de.adorsys.datasafe.encrypiton.api.types.encryption.KeyCreationConfig; @@ -58,17 +58,17 @@ static KeyCreationConfig cmsEncryptionConfig(@Nullable EncryptionConfig config) * Storage credentials access. */ @Binds - abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImpl impl); + abstract ProfileStorageCredentialsService profileStorageCredentialsService(ProfileStorageCredentialsServiceImplRuntimeDelegatable impl); /** * Resource resolver that simply prepends relevant path segment from profile based on location type. */ @Binds - abstract ResourceResolver resourceResolver(ResourceResolverImpl impl); + abstract ResourceResolver resourceResolver(ResourceResolverImplRuntimeDelegatable impl); /** * Aggregate service for profile operations. */ @Binds - abstract ProfileOperations profileService(DFSBasedProfileStorageImpl impl); + abstract ProfileOperations profileService(DFSBasedProfileStorageImplRuntimeDelegatable impl); } From ca6d4b1c464d84405eede1ee0f1ecaa902cfbf8e Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Tue, 2 Jul 2024 12:24:05 +0100 Subject: [PATCH 5/5] Removed TODO comment --- .../adorsys/datasafe/types/api/resource/BasePrivateResource.java | 1 - 1 file changed, 1 deletion(-) diff --git a/datasafe-types-api/src/main/java/de/adorsys/datasafe/types/api/resource/BasePrivateResource.java b/datasafe-types-api/src/main/java/de/adorsys/datasafe/types/api/resource/BasePrivateResource.java index 954cb636f..97d6dd870 100644 --- a/datasafe-types-api/src/main/java/de/adorsys/datasafe/types/api/resource/BasePrivateResource.java +++ b/datasafe-types-api/src/main/java/de/adorsys/datasafe/types/api/resource/BasePrivateResource.java @@ -27,7 +27,6 @@ private BasePrivateResource() { this.encryptedPath = EMPTY_URI; } - // TODO: Hide it public BasePrivateResource(Uri containerUri) { this.container = containerUri; this.decryptedPath = EMPTY_URI;