MCPcopy Create free account
hub / github.com/hashicorp/vault / getMFAValidationRequired

Method getMFAValidationRequired

command/base.go:312–322  ·  view source on GitHub ↗

getMFAValidationRequired checks to see if the secret exists and has an MFA requirement. If MFA is required and the number of constraints is greater than 1, we can assert that interactive validation is not required.

(secret *api.Secret)

Source from the content-addressed store, hash-verified

310// requirement. If MFA is required and the number of constraints is greater than
311// 1, we can assert that interactive validation is not required.
312func (c *BaseCommand) getMFAValidationRequired(secret *api.Secret) bool {
313 if secret != nil && secret.Auth != nil && secret.Auth.MFARequirement != nil {
314 if c.flagMFA == nil && len(secret.Auth.MFARequirement.MFAConstraints) == 1 {
315 return true
316 } else if len(secret.Auth.MFARequirement.MFAConstraints) > 1 {
317 return true
318 }
319 }
320
321 return false
322}
323
324// getInteractiveMFAMethodInfo returns MFA method information only if operating
325// in interactive mode and one MFA method is configured.

Callers 2

RunMethod · 0.80
handleWriteSecretOutputFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected