sts: validate if iam subsystem initialized in handlers (#17796)

This commit is contained in:
Poorna
2023-08-03 13:24:25 -07:00
committed by GitHub
parent 0285df5a02
commit b762fbaf21
3 changed files with 32 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ func writeSTSErrorResponse(ctx context.Context, w http.ResponseWriter, errCode S
stsErrorResponse.Error.Message = errCtxt.Error()
}
switch errCode {
case ErrSTSInternalError, ErrSTSNotInitialized, ErrSTSUpstreamError:
case ErrSTSInternalError, ErrSTSNotInitialized, ErrSTSUpstreamError, ErrSTSIAMNotInitialized:
logger.LogIf(ctx, errCtxt, logger.Minio)
}
encodedErrorResponse := encodeResponse(stsErrorResponse)
@@ -82,6 +82,7 @@ const (
ErrSTSInsecureConnection
ErrSTSInvalidClientCertificate
ErrSTSNotInitialized
ErrSTSIAMNotInitialized
ErrSTSUpstreamError
ErrSTSInternalError
)
@@ -149,6 +150,11 @@ var stsErrCodes = stsErrorCodeMap{
Description: "STS API not initialized, please try again.",
HTTPStatusCode: http.StatusServiceUnavailable,
},
ErrSTSIAMNotInitialized: {
Code: "STSIAMNotInitialized",
Description: "STS IAM not initialized, please try again.",
HTTPStatusCode: http.StatusServiceUnavailable,
},
ErrSTSUpstreamError: {
Code: "InternalError",
Description: "An upstream service required for this operation failed - please try again or contact an administrator.",