mirror of
https://github.com/minio/minio.git
synced 2025-04-08 05:35:33 -04:00
Add enable flag for LDAP IDP config (#16805)
This commit is contained in:
parent
d1e775313d
commit
58266c9e2c
@ -86,7 +86,7 @@ func (a adminAPIHandlers) addOrUpdateIDPHandler(ctx context.Context, w http.Resp
|
|||||||
if idpCfgType == madmin.LDAPIDPCfg && cfgName != madmin.Default {
|
if idpCfgType == madmin.LDAPIDPCfg && cfgName != madmin.Default {
|
||||||
// LDAP does not support multiple configurations. So cfgName must be
|
// LDAP does not support multiple configurations. So cfgName must be
|
||||||
// empty or `madmin.Default`.
|
// empty or `madmin.Default`.
|
||||||
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrBadRequest), r.URL)
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrAdminConfigLDAPNonDefaultConfigName), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,6 +281,7 @@ const (
|
|||||||
ErrAdminConfigEnvOverridden
|
ErrAdminConfigEnvOverridden
|
||||||
ErrAdminConfigDuplicateKeys
|
ErrAdminConfigDuplicateKeys
|
||||||
ErrAdminConfigInvalidIDPType
|
ErrAdminConfigInvalidIDPType
|
||||||
|
ErrAdminConfigLDAPNonDefaultConfigName
|
||||||
ErrAdminConfigLDAPValidation
|
ErrAdminConfigLDAPValidation
|
||||||
ErrAdminConfigIDPCfgNameAlreadyExists
|
ErrAdminConfigIDPCfgNameAlreadyExists
|
||||||
ErrAdminConfigIDPCfgNameDoesNotExist
|
ErrAdminConfigIDPCfgNameDoesNotExist
|
||||||
@ -1333,6 +1334,11 @@ var errorCodes = errorCodeMap{
|
|||||||
Description: fmt.Sprintf("Invalid IDP configuration type - must be one of %v", madmin.ValidIDPConfigTypes),
|
Description: fmt.Sprintf("Invalid IDP configuration type - must be one of %v", madmin.ValidIDPConfigTypes),
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
|
ErrAdminConfigLDAPNonDefaultConfigName: {
|
||||||
|
Code: "XMinioAdminConfigLDAPNonDefaultConfigName",
|
||||||
|
Description: "Only a single LDAP configuration is supported - config name must be empty or `_`",
|
||||||
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
|
},
|
||||||
ErrAdminConfigLDAPValidation: {
|
ErrAdminConfigLDAPValidation: {
|
||||||
Code: "XMinioAdminConfigLDAPValidation",
|
Code: "XMinioAdminConfigLDAPValidation",
|
||||||
Description: "LDAP Configuration validation failed",
|
Description: "LDAP Configuration validation failed",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -98,6 +98,10 @@ var removedKeys = []string{
|
|||||||
// DefaultKVS - default config for LDAP config
|
// DefaultKVS - default config for LDAP config
|
||||||
var (
|
var (
|
||||||
DefaultKVS = config.KVS{
|
DefaultKVS = config.KVS{
|
||||||
|
config.KV{
|
||||||
|
Key: config.Enable,
|
||||||
|
Value: "",
|
||||||
|
},
|
||||||
config.KV{
|
config.KV{
|
||||||
Key: ServerAddr,
|
Key: ServerAddr,
|
||||||
Value: "",
|
Value: "",
|
||||||
@ -184,6 +188,16 @@ func Lookup(s config.Config, rootCAs *x509.CertPool) (l Config, err error) {
|
|||||||
ServerAddr: ldapServer,
|
ServerAddr: ldapServer,
|
||||||
SRVRecordName: getCfgVal(SRVRecordName),
|
SRVRecordName: getCfgVal(SRVRecordName),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse explicity enable=on/off flag. If not set, defaults to `true`
|
||||||
|
// because ServerAddr is set.
|
||||||
|
if v := getCfgVal(config.Enable); v != "" {
|
||||||
|
l.LDAP.Enabled, err = config.ParseBool(v)
|
||||||
|
if err != nil {
|
||||||
|
return l, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
l.stsExpiryDuration = defaultLDAPExpiry
|
l.stsExpiryDuration = defaultLDAPExpiry
|
||||||
|
|
||||||
// LDAP connection configuration
|
// LDAP connection configuration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user