mirror of https://github.com/minio/minio.git
fix: expiration time for share link when using OpenID (#18297)
This commit is contained in:
parent
877e0cac03
commit
06f59ad631
|
@ -167,9 +167,12 @@ func minioConfigToConsoleFeatures() {
|
||||||
if value := env.Get(config.EnvBrowserLoginAnimation, "on"); value != "" {
|
if value := env.Get(config.EnvBrowserLoginAnimation, "on"); value != "" {
|
||||||
os.Setenv("CONSOLE_ANIMATED_LOGIN", value)
|
os.Setenv("CONSOLE_ANIMATED_LOGIN", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass on the session duration environment variable, else we will default to 12 hours
|
// Pass on the session duration environment variable, else we will default to 12 hours
|
||||||
if value := env.Get(config.EnvBrowserSessionDuration, ""); value != "" {
|
if valueSts := env.Get(config.EnvMinioStsDuration, ""); valueSts != "" {
|
||||||
os.Setenv("CONSOLE_STS_DURATION", value)
|
os.Setenv("CONSOLE_STS_DURATION", valueSts)
|
||||||
|
} else if valueSession := env.Get(config.EnvBrowserSessionDuration, ""); valueSession != "" {
|
||||||
|
os.Setenv("CONSOLE_STS_DURATION", valueSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Setenv("CONSOLE_MINIO_REGION", globalSite.Region)
|
os.Setenv("CONSOLE_MINIO_REGION", globalSite.Region)
|
||||||
|
|
|
@ -67,7 +67,8 @@ const (
|
||||||
EnvRootDriveThresholdSize = "MINIO_ROOTDRIVE_THRESHOLD_SIZE"
|
EnvRootDriveThresholdSize = "MINIO_ROOTDRIVE_THRESHOLD_SIZE"
|
||||||
EnvRootDiskThresholdSize = "MINIO_ROOTDISK_THRESHOLD_SIZE" // Deprecated Sep 2023
|
EnvRootDiskThresholdSize = "MINIO_ROOTDISK_THRESHOLD_SIZE" // Deprecated Sep 2023
|
||||||
EnvBrowserLoginAnimation = "MINIO_BROWSER_LOGIN_ANIMATION"
|
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"
|
EnvMinIOLogQueryURL = "MINIO_LOG_QUERY_URL"
|
||||||
EnvMinIOLogQueryAuthToken = "MINIO_LOG_QUERY_AUTH_TOKEN"
|
EnvMinIOLogQueryAuthToken = "MINIO_LOG_QUERY_AUTH_TOKEN"
|
||||||
EnvMinIOPrometheusURL = "MINIO_PROMETHEUS_URL"
|
EnvMinIOPrometheusURL = "MINIO_PROMETHEUS_URL"
|
||||||
|
|
|
@ -36,6 +36,7 @@ import (
|
||||||
"github.com/minio/minio/internal/config"
|
"github.com/minio/minio/internal/config"
|
||||||
"github.com/minio/minio/internal/config/identity/openid/provider"
|
"github.com/minio/minio/internal/config/identity/openid/provider"
|
||||||
"github.com/minio/minio/internal/hash/sha256"
|
"github.com/minio/minio/internal/hash/sha256"
|
||||||
|
"github.com/minio/pkg/v2/env"
|
||||||
xnet "github.com/minio/pkg/v2/net"
|
xnet "github.com/minio/pkg/v2/net"
|
||||||
"github.com/minio/pkg/v2/policy"
|
"github.com/minio/pkg/v2/policy"
|
||||||
)
|
)
|
||||||
|
@ -599,7 +600,11 @@ func (r Config) GetRoleInfo() map[arn.ARN]string {
|
||||||
|
|
||||||
// GetDefaultExpiration - returns the expiration seconds expected.
|
// GetDefaultExpiration - returns the expiration seconds expected.
|
||||||
func GetDefaultExpiration(dsecs string) (time.Duration, error) {
|
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 != "" {
|
if dsecs != "" {
|
||||||
expirySecs, err := strconv.ParseInt(dsecs, 10, 64)
|
expirySecs, err := strconv.ParseInt(dsecs, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue