MCPcopy Index your code
hub / github.com/Adembc/lazyssh / createAuthenticationForm

Method createAuthenticationForm

internal/adapters/ui/server_form.go:1477–1542  ·  view source on GitHub ↗

createAuthenticationForm creates the Authentication tab

()

Source from the content-addressed store, hash-verified

1475
1476// createAuthenticationForm creates the Authentication tab
1477func (sf *ServerForm) createAuthenticationForm() {
1478 form := tview.NewForm()
1479 defaultValues := sf.getDefaultValues()
1480
1481 // Most common: Public key authentication
1482 form.AddTextView("\n[yellow]▶ Public Key Authentication[-]", "", 0, 1, true, false)
1483
1484 // PubkeyAuthentication dropdown
1485 pubkeyOptions := createOptionsWithDefault("PubkeyAuthentication", []string{"", "yes", "no"})
1486 pubkeyIndex := sf.findOptionIndex(pubkeyOptions, defaultValues.PubkeyAuthentication)
1487 sf.addDropDownWithHelp(form, "PubkeyAuthentication:", "PubkeyAuthentication", pubkeyOptions, pubkeyIndex)
1488
1489 // IdentitiesOnly dropdown - controls whether to use only specified identity files
1490 identitiesOnlyOptions := createOptionsWithDefault("IdentitiesOnly", []string{"", "yes", "no"})
1491 identitiesOnlyIndex := sf.findOptionIndex(identitiesOnlyOptions, defaultValues.IdentitiesOnly)
1492 sf.addDropDownWithHelp(form, "IdentitiesOnly:", "IdentitiesOnly", identitiesOnlyOptions, identitiesOnlyIndex)
1493
1494 // SSH Agent settings
1495 form.AddTextView("\n[yellow]▶ SSH Agent[-]", "", 0, 1, true, false)
1496
1497 // AddKeysToAgent dropdown
1498 addKeysOptions := createOptionsWithDefault("AddKeysToAgent", []string{"", "yes", "no", "ask", "confirm"})
1499 addKeysIndex := sf.findOptionIndex(addKeysOptions, defaultValues.AddKeysToAgent)
1500 sf.addDropDownWithHelp(form, "AddKeysToAgent:", "AddKeysToAgent", addKeysOptions, addKeysIndex)
1501
1502 sf.addInputFieldWithHelp(form, "IdentityAgent:", "IdentityAgent", defaultValues.IdentityAgent, 40, GetFieldPlaceholder("IdentityAgent"))
1503
1504 // Password/Interactive authentication
1505 form.AddTextView("\n[yellow]▶ Password & Interactive[-]", "", 0, 1, true, false)
1506
1507 // PasswordAuthentication dropdown
1508 passwordOptions := createOptionsWithDefault("PasswordAuthentication", []string{"", "yes", "no"})
1509 passwordIndex := sf.findOptionIndex(passwordOptions, defaultValues.PasswordAuthentication)
1510 sf.addDropDownWithHelp(form, "PasswordAuthentication:", "PasswordAuthentication", passwordOptions, passwordIndex)
1511
1512 // KbdInteractiveAuthentication dropdown
1513 kbdInteractiveOptions := createOptionsWithDefault("KbdInteractiveAuthentication", []string{"", "yes", "no"})
1514 kbdInteractiveIndex := sf.findOptionIndex(kbdInteractiveOptions, defaultValues.KbdInteractiveAuthentication)
1515 sf.addDropDownWithHelp(form, "KbdInteractiveAuthentication:", "KbdInteractiveAuthentication", kbdInteractiveOptions, kbdInteractiveIndex)
1516
1517 // NumberOfPasswordPrompts field
1518 sf.addValidatedInputField(form, "NumberOfPasswordPrompts:", "NumberOfPasswordPrompts", defaultValues.NumberOfPasswordPrompts, 10, GetFieldPlaceholder("NumberOfPasswordPrompts"))
1519
1520 // Advanced: Authentication order preference
1521 form.AddTextView("\n[yellow]▶ Advanced[-]", "", 0, 1, true, false)
1522
1523 sf.addInputFieldWithHelp(form, "PreferredAuthentications:", "PreferredAuthentications", defaultValues.PreferredAuthentications, 40, GetFieldPlaceholder("PreferredAuthentications"))
1524
1525 // PubkeyAcceptedAlgorithms with autocomplete support (moved from Advanced/Cryptography)
1526 pubkeyAlgField := sf.addInputFieldWithHelp(form, "PubkeyAcceptedAlgorithms:", "PubkeyAcceptedAlgorithms", defaultValues.PubkeyAcceptedAlgorithms, 40, GetFieldPlaceholder("PubkeyAcceptedAlgorithms"))
1527 pubkeyAlgField.SetAutocompleteFunc(sf.createAlgorithmAutocomplete(pubkeyAlgorithms))
1528
1529 // HostbasedAcceptedAlgorithms with autocomplete support (moved from Advanced/Cryptography)
1530 hostbasedAlgField := sf.addInputFieldWithHelp(form, "HostbasedAcceptedAlgorithms:", "HostbasedAcceptedAlgorithms", defaultValues.HostbasedAcceptedAlgorithms, 40, GetFieldPlaceholder("HostbasedAcceptedAlgorithms"))
1531 hostbasedAlgField.SetAutocompleteFunc(sf.createAlgorithmAutocomplete(pubkeyAlgorithms))
1532
1533 // Add save and cancel buttons
1534 form.AddButton("Save", sf.handleSaveButton)

Callers 1

buildMethod · 0.95

Calls 9

getDefaultValuesMethod · 0.95
findOptionIndexMethod · 0.95
addDropDownWithHelpMethod · 0.95
addInputFieldWithHelpMethod · 0.95
setupFormShortcutsMethod · 0.95
createOptionsWithDefaultFunction · 0.85
GetFieldPlaceholderFunction · 0.85

Tested by

no test coverage detected