fix: expiration time for share link when using OpenID (#18297)

This commit is contained in:
Adrian Najera
2023-10-30 11:21:34 -06:00
committed by GitHub
parent 877e0cac03
commit 06f59ad631
3 changed files with 13 additions and 4 deletions

View File

@@ -67,7 +67,8 @@ const (
EnvRootDriveThresholdSize = "MINIO_ROOTDRIVE_THRESHOLD_SIZE"
EnvRootDiskThresholdSize = "MINIO_ROOTDISK_THRESHOLD_SIZE" // Deprecated Sep 2023
EnvBrowserLoginAnimation = "MINIO_BROWSER_LOGIN_ANIMATION"
EnvBrowserSessionDuration = "MINIO_BROWSER_SESSION_DURATION"
EnvBrowserSessionDuration = "MINIO_BROWSER_SESSION_DURATION" // Deprecated after November 2023
EnvMinioStsDuration = "MINIO_STS_DURATION"
EnvMinIOLogQueryURL = "MINIO_LOG_QUERY_URL"
EnvMinIOLogQueryAuthToken = "MINIO_LOG_QUERY_AUTH_TOKEN"
EnvMinIOPrometheusURL = "MINIO_PROMETHEUS_URL"

View File

@@ -36,6 +36,7 @@ import (
"github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/config/identity/openid/provider"
"github.com/minio/minio/internal/hash/sha256"
"github.com/minio/pkg/v2/env"
xnet "github.com/minio/pkg/v2/net"
"github.com/minio/pkg/v2/policy"
)
@@ -599,7 +600,11 @@ func (r Config) GetRoleInfo() map[arn.ARN]string {
// GetDefaultExpiration - returns the expiration seconds expected.
func GetDefaultExpiration(dsecs string) (time.Duration, error) {
defaultExpiryDuration := time.Duration(60) * time.Minute // Defaults to 1hr.
timeout := env.Get(config.EnvMinioStsDuration, "")
defaultExpiryDuration, err := time.ParseDuration(timeout)
if err != nil {
defaultExpiryDuration = time.Duration(60) * time.Minute
}
if dsecs != "" {
expirySecs, err := strconv.ParseInt(dsecs, 10, 64)
if err != nil {