mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Support adding service accounts with expiration (#16430)
Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
@@ -88,6 +88,9 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// claim key found in credentials which are service accounts
|
||||
const iamPolicyClaimNameSA = "sa-policy"
|
||||
|
||||
const (
|
||||
// AccountOn indicates that credentials are enabled
|
||||
AccountOn = "on"
|
||||
@@ -140,7 +143,8 @@ func (cred Credentials) IsTemp() bool {
|
||||
|
||||
// IsServiceAccount - returns whether credential is a service account or not
|
||||
func (cred Credentials) IsServiceAccount() bool {
|
||||
return cred.ParentUser != "" && (cred.Expiration.IsZero() || cred.Expiration.Equal(timeSentinel))
|
||||
_, ok := cred.Claims[iamPolicyClaimNameSA]
|
||||
return cred.ParentUser != "" && ok
|
||||
}
|
||||
|
||||
// IsValid - returns whether credential is valid or not.
|
||||
|
||||
Reference in New Issue
Block a user