@@ -98,7 +98,12 @@ public void testCustomHostname() throws Exception {
9898 final Calendar expiry = Calendar .getInstance (TimeZone .getTimeZone ("UTC" ));
9999 expiry .add (Calendar .MILLISECOND , (int ) TimeUnit .DAYS .toMillis (7 ));
100100 final Host host = new Host (new S3Protocol (), "h" );
101- final S3Session session = new S3Session (host );
101+ final S3Session session = new S3Session (host ) {
102+ @ Override
103+ public S3CredentialsStrategy getAuthentication () {
104+ return host ::getCredentials ;
105+ }
106+ };
102107 final String url = new S3PresignedUrlProvider (session ).create (session .getAuthentication ().get (),
103108 "test-us-east-1-cyberduck" , "us-east-1" , "f" , "GET" , expiry .getTimeInMillis ());
104109 assertNotNull (url );
@@ -110,7 +115,12 @@ public void testCustomHostnameWithRegion() throws Exception {
110115 final Calendar expiry = Calendar .getInstance (TimeZone .getTimeZone ("UTC" ));
111116 expiry .add (Calendar .MILLISECOND , (int ) TimeUnit .DAYS .toMillis (7 ));
112117 final Host host = new Host (new S3Protocol (), "s3.eu-central-1.wasabisys.com" );
113- final S3Session session = new S3Session (host );
118+ final S3Session session = new S3Session (host ) {
119+ @ Override
120+ public S3CredentialsStrategy getAuthentication () {
121+ return host ::getCredentials ;
122+ }
123+ };
114124 final String url = new S3PresignedUrlProvider (session ).create (session .getAuthentication ().get (),
115125 "cyberduck" , "eu-central-1" , "f" , "GET" , expiry .getTimeInMillis ());
116126 assertNotNull (url );
@@ -127,7 +137,12 @@ public String getDefaultHostname() {
127137 return "wasabisys.com" ;
128138 }
129139 }, "wasabisys.com" );
130- final S3Session session = new S3Session (host );
140+ final S3Session session = new S3Session (host ) {
141+ @ Override
142+ public S3CredentialsStrategy getAuthentication () {
143+ return host ::getCredentials ;
144+ }
145+ };
131146 final String url = new S3PresignedUrlProvider (session ).create (session .getAuthentication ().get (),
132147 "cyberduck" , "eu-central-1" , "f" , "GET" , expiry .getTimeInMillis ());
133148 assertNotNull (url );
@@ -144,7 +159,12 @@ public String getDefaultHostname() {
144159 return "h" ;
145160 }
146161 }, "h" );
147- final S3Session session = new S3Session (host );
162+ final S3Session session = new S3Session (host ) {
163+ @ Override
164+ public S3CredentialsStrategy getAuthentication () {
165+ return host ::getCredentials ;
166+ }
167+ };
148168 final String url = new S3PresignedUrlProvider (session ).create (session .getAuthentication ().get (),
149169 "test-us-east-1-cyberduck" , "us-east-1" , "f" , "GET" , expiry .getTimeInMillis ());
150170 assertNotNull (url );
@@ -164,7 +184,12 @@ public String getProperty(final String key) {
164184 return super .getProperty (key );
165185 }
166186 };
167- final S3Session session = new S3Session (host );
187+ final S3Session session = new S3Session (host ) {
188+ @ Override
189+ public S3CredentialsStrategy getAuthentication () {
190+ return host ::getCredentials ;
191+ }
192+ };
168193 final Calendar expiry = Calendar .getInstance (TimeZone .getTimeZone ("UTC" ));
169194 expiry .add (Calendar .MILLISECOND , (int ) TimeUnit .DAYS .toMillis (7 ));
170195 final String url = new S3PresignedUrlProvider (session ).create (session .getAuthentication ().get (),
0 commit comments