mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-05 14:04:02 +00:00
Update dependencies/vendor (#1659)
This commit is contained in:
20
vendor/github.com/minio/minio-go/v7/pkg/credentials/credentials.go
generated
vendored
20
vendor/github.com/minio/minio-go/v7/pkg/credentials/credentials.go
generated
vendored
@ -22,8 +22,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// STSVersion sts version string
|
||||
const STSVersion = "2011-06-15"
|
||||
const (
|
||||
// STSVersion sts version string
|
||||
STSVersion = "2011-06-15"
|
||||
|
||||
// How much duration to slash from the given expiration duration
|
||||
defaultExpiryWindow = 0.8
|
||||
)
|
||||
|
||||
// A Value is the AWS credentials value for individual credential fields.
|
||||
type Value struct {
|
||||
@ -82,10 +87,15 @@ type Expiry struct {
|
||||
// the expiration time given to ensure no requests are made with expired
|
||||
// tokens.
|
||||
func (e *Expiry) SetExpiration(expiration time.Time, window time.Duration) {
|
||||
e.expiration = expiration
|
||||
if window > 0 {
|
||||
e.expiration = e.expiration.Add(-window)
|
||||
if e.CurrentTime == nil {
|
||||
e.CurrentTime = time.Now
|
||||
}
|
||||
cut := window
|
||||
if cut < 0 {
|
||||
expireIn := expiration.Sub(e.CurrentTime())
|
||||
cut = time.Duration(float64(expireIn) * (1 - defaultExpiryWindow))
|
||||
}
|
||||
e.expiration = expiration.Add(-cut)
|
||||
}
|
||||
|
||||
// IsExpired returns if the credentials are expired.
|
||||
|
Reference in New Issue
Block a user