mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
VAULT-6433 do not return nil resp if ns is nil (#16937)
* VAULT-6433 do not return nil resp if ns is nil * VAULT-6433 typo
This commit is contained in:
@@ -1362,10 +1362,12 @@ func (b *LoginMFABackend) mfaLoginEnforcementConfigToMap(eConfig *mfa.MFAEnforce
|
|||||||
resp := make(map[string]interface{})
|
resp := make(map[string]interface{})
|
||||||
resp["name"] = eConfig.Name
|
resp["name"] = eConfig.Name
|
||||||
ns, err := b.namespacer.NamespaceByID(context.Background(), eConfig.NamespaceID)
|
ns, err := b.namespacer.NamespaceByID(context.Background(), eConfig.NamespaceID)
|
||||||
if ns == nil || err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp["namespace_path"] = ns.Path
|
if ns != nil {
|
||||||
|
resp["namespace_path"] = ns.Path
|
||||||
|
}
|
||||||
resp["namespace_id"] = eConfig.NamespaceID
|
resp["namespace_id"] = eConfig.NamespaceID
|
||||||
resp["mfa_method_ids"] = append([]string{}, eConfig.MFAMethodIDs...)
|
resp["mfa_method_ids"] = append([]string{}, eConfig.MFAMethodIDs...)
|
||||||
resp["auth_method_accessors"] = append([]string{}, eConfig.AuthMethodAccessors...)
|
resp["auth_method_accessors"] = append([]string{}, eConfig.AuthMethodAccessors...)
|
||||||
@@ -1423,10 +1425,12 @@ func (b *MFABackend) mfaConfigToMap(mConfig *mfa.Config) (map[string]interface{}
|
|||||||
respData["name"] = mConfig.Name
|
respData["name"] = mConfig.Name
|
||||||
respData["namespace_id"] = mConfig.NamespaceID
|
respData["namespace_id"] = mConfig.NamespaceID
|
||||||
ns, err := b.namespacer.NamespaceByID(context.Background(), mConfig.NamespaceID)
|
ns, err := b.namespacer.NamespaceByID(context.Background(), mConfig.NamespaceID)
|
||||||
if ns == nil || err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
respData["namespace_path"] = ns.Path
|
if ns != nil {
|
||||||
|
respData["namespace_path"] = ns.Path
|
||||||
|
}
|
||||||
|
|
||||||
return respData, nil
|
return respData, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user