mirror of
https://github.com/minio/minio.git
synced 2025-04-22 03:24:38 -04:00
fix: truncate Expiration to second when Add ServiceAccount (#19674)
Truncate Expiration at the second when Add ServiceAccount
This commit is contained in:
parent
2f7a10ab31
commit
47a4ad3cd7
@ -2476,6 +2476,12 @@ func commonAddServiceAccount(r *http.Request) (context.Context, auth.Credentials
|
|||||||
return ctx, auth.Credentials{}, newServiceAccountOpts{}, madmin.AddServiceAccountReq{}, "", errorCodes.ToAPIErrWithErr(ErrAdminConfigBadJSON, err)
|
return ctx, auth.Credentials{}, newServiceAccountOpts{}, madmin.AddServiceAccountReq{}, "", errorCodes.ToAPIErrWithErr(ErrAdminConfigBadJSON, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if createReq.Expiration != nil && !createReq.Expiration.IsZero() {
|
||||||
|
// truncate expiration at the second.
|
||||||
|
truncateTime := createReq.Expiration.Truncate(time.Second)
|
||||||
|
createReq.Expiration = &truncateTime
|
||||||
|
}
|
||||||
|
|
||||||
// service account access key cannot have space characters beginning and end of the string.
|
// service account access key cannot have space characters beginning and end of the string.
|
||||||
if hasSpaceBE(createReq.AccessKey) {
|
if hasSpaceBE(createReq.AccessKey) {
|
||||||
return ctx, auth.Credentials{}, newServiceAccountOpts{}, madmin.AddServiceAccountReq{}, "", errorCodes.ToAPIErr(ErrAdminResourceInvalidArgument)
|
return ctx, auth.Credentials{}, newServiceAccountOpts{}, madmin.AddServiceAccountReq{}, "", errorCodes.ToAPIErr(ErrAdminResourceInvalidArgument)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user