@@ -307,7 +307,7 @@ func newAdminFromClaims(claims *models.Principal) (*madmin.AdminClient, error) {
307
307
if err != nil {
308
308
return nil , err
309
309
}
310
- adminClient .SetCustomTransport (getSTSClient ().Transport )
310
+ adminClient .SetCustomTransport (GetConsoleSTSClient ().Transport )
311
311
return adminClient , nil
312
312
}
313
313
@@ -316,17 +316,20 @@ var (
316
316
consoleSecretKey = getSecretKey ()
317
317
)
318
318
319
- // stsClient is an http.Client with Custom TLS Transport that loads certificates from .console/certs/CAs
319
+ // stsClient is a custom http client, this client should not be called directly and instead be
320
+ // called using GetConsoleSTSClient() to ensure is initialized and the certificates are loaded correctly
320
321
var stsClient * http.Client
321
- var consoleLDAPAdminCreds consoleCredentials
322
322
323
- func getSTSClient () * http.Client {
323
+ // GetConsoleSTSClient will initialize the console STS Client with Custom TLS Transport that with loads certs at .console/certs/CAs
324
+ func GetConsoleSTSClient () * http.Client {
324
325
if stsClient == nil {
325
326
stsClient = PrepareSTSClient (false )
326
327
}
327
328
return stsClient
328
329
}
329
330
331
+ var consoleLDAPAdminCreds consoleCredentials
332
+
330
333
func newSuperMAdminClient () (* madmin.AdminClient , error ) {
331
334
accessKey := consoleAccessKey
332
335
secretKey := consoleSecretKey
@@ -336,7 +339,7 @@ func newSuperMAdminClient() (*madmin.AdminClient, error) {
336
339
if ldap .GetLDAPEnabled () {
337
340
// initialize LDAP super Admin Credentials once
338
341
if consoleLDAPAdminCreds .consoleCredentials == nil {
339
- consoleCredentialsFromLDAP , err := auth .GetCredentialsFromLDAP (getSTSClient (), MinioEndpoint , consoleAccessKey , consoleSecretKey )
342
+ consoleCredentialsFromLDAP , err := auth .GetCredentialsFromLDAP (GetConsoleSTSClient (), MinioEndpoint , consoleAccessKey , consoleSecretKey )
340
343
if err != nil {
341
344
return nil , err
342
345
}
0 commit comments