44
55package cloud .katta .protocols .hub ;
66
7- import ch .cyberduck .core .*;
7+ import ch .cyberduck .core .CredentialsConfigurator ;
8+ import ch .cyberduck .core .DisabledCancelCallback ;
9+ import ch .cyberduck .core .DisabledHostKeyCallback ;
10+ import ch .cyberduck .core .Host ;
11+ import ch .cyberduck .core .HostUrlProvider ;
12+ import ch .cyberduck .core .LoginCallback ;
13+ import ch .cyberduck .core .PasswordCallback ;
14+ import ch .cyberduck .core .Path ;
15+ import ch .cyberduck .core .PathAttributes ;
16+ import ch .cyberduck .core .Protocol ;
17+ import ch .cyberduck .core .ProtocolFactory ;
18+ import ch .cyberduck .core .Session ;
19+ import ch .cyberduck .core .SessionFactory ;
20+ import ch .cyberduck .core .UUIDRandomStringService ;
821import ch .cyberduck .core .cryptomator .ContentWriter ;
922import ch .cyberduck .core .cryptomator .UVFVault ;
1023import ch .cyberduck .core .exception .BackgroundException ;
@@ -99,7 +112,7 @@ public HubUVFVault(final HubSession hub, final UUID vaultId, final UvfMetadataPa
99112 new PathAttributes ().setDisplayname (vaultMetadata .storage ().getNickname ())), vaultMetadata , prompt );
100113 }
101114
102- public HubUVFVault (final HubSession hub , final UUID vaultId , final Path bucket , final UvfMetadataPayload vaultMetadata , final LoginCallback prompt ) throws ConnectionCanceledException {
115+ public HubUVFVault (final HubSession session , final UUID vaultId , final Path bucket , final UvfMetadataPayload vaultMetadata , final LoginCallback prompt ) throws ConnectionCanceledException {
103116 super (bucket );
104117 this .vaultId = vaultId ;
105118 this .vaultMetadata = vaultMetadata ;
@@ -108,20 +121,12 @@ public HubUVFVault(final HubSession hub, final UUID vaultId, final Path bucket,
108121 final VaultMetadataJWEBackendDto vaultStorageMetadata = vaultMetadata .storage ();
109122 final Protocol profile = ProtocolFactory .get ().forName (vaultStorageMetadata .getProvider ());
110123 log .debug ("Loaded profile {} for UVF metadata {}" , profile , vaultMetadata );
111- final Credentials credentials =
112- hub .getFeature (CredentialsConfigurator .class ).reload ().configure (hub .getHost ());
113- log .debug ("Copy credentials {}" , credentials );
114- if (vaultStorageMetadata .getUsername () != null ) {
115- credentials .setUsername (vaultStorageMetadata .getUsername ());
116- }
117- if (vaultStorageMetadata .getPassword () != null ) {
118- credentials .setPassword (vaultStorageMetadata .getPassword ());
119- }
120- final Host storageProvider = new Host (profile , credentials );
124+ final Host storageProvider = new Host (profile , session .getFeature (CredentialsConfigurator .class ).reload ().configure (session .getHost ())
125+ .withUsername (vaultStorageMetadata .getUsername ()).withPassword (vaultStorageMetadata .getPassword ()));
121126 storageProvider .setProperty (OAUTH_TOKENEXCHANGE_VAULT , vaultId .toString ());
122127 storageProvider .setRegion (vaultStorageMetadata .getRegion ());
123128 log .debug ("Configured {} for vault {}" , storageProvider , this );
124- this .storage = SessionFactory .create (storageProvider , hub .getFeature (X509TrustManager .class ), hub .getFeature (X509KeyManager .class ));
129+ this .storage = SessionFactory .create (storageProvider , session .getFeature (X509TrustManager .class ), session .getFeature (X509KeyManager .class ));
125130 }
126131
127132 /**
0 commit comments