Prevent empty credentials

Always require identity (username).

Zero passwords are no security. Prevent zero passwords too.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-04-17 14:22:25 +02:00
parent 63db62453a
commit d945ccac73
7 changed files with 539 additions and 661 deletions

View File

@ -2,14 +2,14 @@
msgid ""
msgstr ""
"Project-Id-Version: EAPMethods\n"
"POT-Creation-Date: 2020-04-17 06:54+0200\n"
"POT-Creation-Date: 2020-04-17 14:55+0200\n"
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.4\n"
"X-Generator: Poedit 2.3\n"
"X-Poedit-Basepath: ../..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
@ -22,71 +22,71 @@ msgstr ""
"X-Poedit-SearchPath-6: lib/TTLS_UI\n"
"X-Poedit-SearchPath-7: EAPMethods\n"
#: lib/EAPBase_UI/include/EAP_UI.h:294
#: lib/EAPBase_UI/include/EAP_UI.h:295
#, c-format
msgid "Are you sure you want to permanently remove %s provider from configuration?"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:294
#: lib/EAPBase_UI/include/EAP_UI.h:295
msgid "Warning"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:380 lib/EAPBase_UI/res/wxEAP_UI.h:117
#: lib/EAPBase_UI/include/EAP_UI.h:381 lib/EAPBase_UI/res/wxEAP_UI.h:116
msgid "EAP Credentials"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:724
#: lib/EAPBase_UI/include/EAP_UI.h:725
msgid "Provider Settings"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:757 lib/EAPBase_UI/res/wxEAP_UI.cpp:229
#: lib/EAPBase_UI/include/EAP_UI.h:758 lib/EAPBase_UI/res/wxEAP_UI.cpp:229
#, c-format
msgid "%s User Credentials"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:876 lib/TTLS_UI/src/Module.cpp:196
#: lib/EAPBase_UI/include/EAP_UI.h:866 lib/TTLS_UI/src/Module.cpp:196
#: lib/TTLS_UI/src/Module.cpp:305
#, c-format
msgid "Error writing credentials to Credential Manager: %hs (error %u)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:879 lib/TTLS_UI/src/Module.cpp:198
#: lib/EAPBase_UI/include/EAP_UI.h:869 lib/TTLS_UI/src/Module.cpp:198
#: lib/TTLS_UI/src/Module.cpp:307
msgid "Writing credentials failed."
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:899
#: lib/EAPBase_UI/include/EAP_UI.h:897
#, c-format
msgid "Deleting credentials failed (error %u)."
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:938
#: lib/EAPBase_UI/include/EAP_UI.h:924 lib/EAPBase_UI/include/EAP_UI.h:943
#: lib/EAPBase_UI/include/EAP_UI.h:952
msgid "(none)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:928
#, c-format
msgid "(error %u)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:942
#: lib/EAPBase_UI/include/EAP_UI.h:932
msgid "(error)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:953 lib/EAPBase_UI/include/EAP_UI.h:962
#: lib/TLS_UI/src/TLS_UI.cpp:61
msgid "(none)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:953 lib/EAPBase_UI/include/EAP_UI.h:962
#: lib/EAPBase_UI/include/EAP_UI.h:943 lib/EAPBase_UI/include/EAP_UI.h:952
msgid "(blank ID)"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:1002
#: lib/EAPBase_UI/include/EAP_UI.h:992
msgid "&Remember"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:1003
#: lib/EAPBase_UI/include/EAP_UI.h:993
msgid "Check if you would like to save credentials"
msgstr ""
#: lib/EAPBase_UI/include/EAP_UI.h:1212
#: lib/EAPBase_UI/include/EAP_UI.h:1214
msgid "(Your Organization)"
msgstr ""
@ -118,205 +118,201 @@ msgstr ""
msgid "Select the source where your credentials used to connect are stored."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:244
msgid "Use from Credential &Manager"
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:250
msgid "Use from Credential &Manager:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:245
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:251
msgid "Select this option if you would like to use credentials stored in Windows Credential Manager"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:255 lib/EAPBase_UI/res/wxEAP_UI.cpp:299
msgid "Identity:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:262
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:258
msgid "Your present credentials stored in Windows Credential Manager"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:272
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:268
msgid "Use from &profile configuration:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:269
msgid "Select this option if you would like to store credentials as a part of profile configuration"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:276
msgid "Profile configuration credentials"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:289
msgid "&Clear Credentials"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:273
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:290
msgid ""
"Click to clear your credentials from Credential Manager.\n"
"Note: You will be prompted to enter credentials when connecting."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:277 lib/EAPBase_UI/res/wxEAP_UI.cpp:316
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:294
msgid "&Set Credentials..."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:278 lib/EAPBase_UI/res/wxEAP_UI.cpp:317
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:295
msgid "Click here to set or modify your credentials"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:288
msgid "Use from &profile configuration"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:289
msgid "Select this option if you would like to store credentials as a part of profile configuration"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:306
msgid "Profile configuration credentials"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:359
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:332
msgid "User ID and Password"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:369
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:342
msgid "Please provide your user ID and password."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:379 lib/EAPBase_UI/res/wxEAP_UI.cpp:443
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:352 lib/EAPBase_UI/res/wxEAP_UI.cpp:416
msgid "User ID:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:384 lib/EAPBase_UI/res/wxEAP_UI.cpp:448
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:357 lib/EAPBase_UI/res/wxEAP_UI.cpp:421
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:388
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:361
msgid "Password:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:393
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:366
msgid "Enter your password here"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:423
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:396
msgid "User ID"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:433
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:406
msgid "Please provide your user ID."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:473
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:446
msgid "Your Organization"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:484
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:457
msgid "Describe your organization to customize user prompts. When organization is introduced, end-users find program messages easier to understand and act."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:491
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:464
msgid "Your organization &name:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:496
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:469
msgid "Your organization name as it will appear on helpdesk contact notifications"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:500
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:473
msgid "(Keep it short, please)"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:510
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:483
msgid "Helpdesk contact &information:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:527
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:500
msgid "Your helpdesk website address"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:538
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:511
msgid "Your helpdesk e-mail address"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:549
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:522
msgid "Your helpdesk phone number"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:577
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:550
msgid "Provider Unique Identifier"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:588
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:561
msgid "Assign your organization a unique ID to allow sharing the same credential set across different network profiles."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:595
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:568
msgid "&Namespace:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:599
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:572
msgid "urn:RFC4282:realm"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:599
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:572
msgid "urn:uuid"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:611
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:584
msgid "Provider unique &identifier:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:616
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:589
msgid "Your organization ID to assign same credentials from other profiles"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:641
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:614
msgid "Configuration Lock"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:652
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:625
msgid "Your configuration can be locked to prevent accidental modification by end-users. Users will only be allowed to enter credentials."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:659
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:632
msgid "&Lock this configuration and prevent any further modification via user interface."
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:662
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:635
msgid "(Warning: Once locked, you can not revert using this dialog!)"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:727
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:700
msgid "Identity"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:738
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:711
msgid "Select the user ID supplicant introduces itself as to authenticator:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:745
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:718
msgid "&True identity"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:746
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:719
msgid "Use my true user name"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:750
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:723
msgid "Use &empty identity"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:751
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:724
msgid "Omit my user name and use @mydomain.org only"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:758
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:731
msgid "&Custom identity:"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:759
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:732
msgid "Specify custom identity"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:764
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:737
msgid "Custom identity to use"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.h:67
#: lib/EAPBase_UI/res/wxEAP_UI.h:66
msgid "EAP Connection Configuration"
msgstr ""
#: lib/EAPBase_UI/res/wxEAP_UI.h:334
#: lib/EAPBase_UI/res/wxEAP_UI.h:329
msgid "EAP Identity Provider"
msgstr ""
@ -513,7 +509,7 @@ msgstr ""
msgid "(Example: foo.bar.com;server2.bar.com)"
msgstr ""
#: lib/TLS_UI/res/wxTLS_UI.cpp:118 lib/TLS_UI/src/TLS_UI.cpp:329
#: lib/TLS_UI/res/wxTLS_UI.cpp:118 lib/TLS_UI/src/TLS_UI.cpp:400
msgid "User Certificate"
msgstr ""
@ -533,32 +529,40 @@ msgstr ""
msgid "Your identity (username@domain) to override one from certificate; or blank to use one provided in certificate"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:256
#: lib/TLS_UI/src/TLS_UI.cpp:118
msgid "No certificate selected"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:118
msgid "Validation conflict"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:327
msgid "Add Certificate"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:257
#: lib/TLS_UI/src/TLS_UI.cpp:328
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:258
#: lib/TLS_UI/src/TLS_UI.cpp:329
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:259
#: lib/TLS_UI/src/TLS_UI.cpp:330
msgid "PKCS #7 Certificate Files (*.p7b)"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:260
#: lib/TLS_UI/src/TLS_UI.cpp:331
msgid "All Files (*.*)"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:274
#: lib/TLS_UI/src/TLS_UI.cpp:345
#, c-format
msgid "Invalid or unsupported certificate file %s"
msgstr ""
#: lib/TLS_UI/src/TLS_UI.cpp:274
#: lib/TLS_UI/src/TLS_UI.cpp:345
msgid "Error"
msgstr ""
@ -583,17 +587,17 @@ msgid "Invoking EAP interactive UI failed (error %u)."
msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:37
msgid "Outer Authentication"
msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:50
msgid "Inner Authentication"
msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:43
#: lib/TTLS_UI/src/TTLS_UI.cpp:56
msgid "Select inner authentication method from the list"
msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:48
msgid "Outer Authentication"
msgstr ""
#: lib/TTLS_UI/src/TTLS_UI.cpp:127
msgid "PAP"
msgstr ""

View File

@ -126,6 +126,7 @@ inline void wxInitializeConfig();
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/thread.h>
#include <wx/valtext.h>
#include <CommCtrl.h>
@ -810,107 +811,96 @@ protected:
{
wxEAPCredentialsConfigPanelBase::OnUpdateUI(event);
if (m_cfg.m_allow_save) {
if (m_storage->GetValue()) {
m_storage_identity->Enable(true);
m_storage_set ->Enable(true);
m_storage_clear ->Enable(m_has_storage);
} else {
m_storage_identity->Enable(false);
m_storage_set ->Enable(false);
m_storage_clear ->Enable(false);
}
} else {
m_storage_identity->Enable(false);
m_storage_set ->Enable(false);
m_storage_clear ->Enable(false);
}
bool is_storage = m_storage->GetValue();
m_storage_identity->Enable(m_cfg.m_allow_save && is_storage);
m_config_identity->Enable(!m_prov.m_read_only && !is_storage);
if (m_prov.m_read_only) {
// This is provider-locked configuration. Disable controls.
// To avoid run-away selection of radio buttons, disable the selected one last.
if (m_storage->GetValue()) {
if (is_storage) {
m_config ->Enable(false);
m_storage->Enable(false);
} else {
m_storage->Enable(false);
m_config ->Enable(false);
}
m_config_identity->Enable(false);
m_config_set ->Enable(false);
} else {
// This is not a provider-locked configuration. Selectively enable/disable controls.
m_storage->Enable(true);
m_config->Enable(true);
if (m_storage->GetValue()) {
m_config_identity->Enable(false);
m_config_set ->Enable(false);
} else {
m_config_identity->Enable(true);
m_config_set ->Enable(true);
}
}
if (is_storage) {
m_set ->Enable(m_cfg.m_allow_save);
m_clear->Enable(m_cfg.m_allow_save && m_has_storage);
} else {
m_set ->Enable(!m_prov.m_read_only);
m_clear->Enable(!m_prov.m_read_only && !m_cred_config.empty());
}
}
virtual void OnSetStorage(wxCommandEvent& event)
virtual void OnSet(wxCommandEvent& event)
{
wxEAPCredentialsConfigPanelBase::OnSetStorage(event);
wxEAPCredentialsConfigPanelBase::OnSet(event);
m_timer_storage.Stop();
if (m_storage->GetValue()) {
m_timer_storage.Stop();
// Read credentials from Credential Manager.
RetrieveStorageCredentials();
// Read credentials from Credential Manager.
RetrieveStorageCredentials();
// Display credential prompt.
wxEAPCredentialsDialog dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_storage, &dlg, true);
dlg.AddContent(panel);
if (dlg.ShowModal() == wxID_OK) {
// Write credentials to credential manager.
try {
m_cred_storage.store(m_prov.get_id().c_str(), m_cfg.m_level);
m_has_storage = TRUE;
UpdateStorageIdentity();
} catch (winstd::win_runtime_error &err) {
wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %hs (error %u)"), err.what(), err.number()).c_str());
RetrieveStorageCredentials();
} catch (...) {
wxLogError(_("Writing credentials failed."));
RetrieveStorageCredentials();
// Display credential prompt.
wxEAPCredentialsDialog dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_storage, &dlg, true);
dlg.AddContent(panel);
if (dlg.ShowModal() == wxID_OK) {
// Write credentials to credential manager.
try {
m_cred_storage.store(m_prov.get_id().c_str(), m_cfg.m_level);
m_has_storage = true;
UpdateStorageIdentity();
} catch (winstd::win_runtime_error &err) {
wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %hs (error %u)"), err.what(), err.number()).c_str());
RetrieveStorageCredentials();
} catch (...) {
wxLogError(_("Writing credentials failed."));
RetrieveStorageCredentials();
}
}
m_timer_storage.Start(3000);
} else {
wxEAPCredentialsDialog dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_config, &dlg, true);
dlg.AddContent(panel);
if (dlg.ShowModal() == wxID_OK)
UpdateConfigIdentity();
}
m_timer_storage.Start(3000);
}
virtual void OnClearStorage(wxCommandEvent& event)
virtual void OnClear(wxCommandEvent& event)
{
wxEAPCredentialsConfigPanelBase::OnClearStorage(event);
wxEAPCredentialsConfigPanelBase::OnClear(event);
m_timer_storage.Stop();
if (m_storage->GetValue()) {
m_timer_storage.Stop();
if (CredDelete(m_cred_storage.target_name(m_prov.get_id().c_str(), m_cfg.m_level).c_str(), CRED_TYPE_GENERIC, 0)) {
m_storage_identity->SetLabel(wxEmptyString);
m_cred_storage.clear();
m_has_storage = false;
} else
wxLogError(_("Deleting credentials failed (error %u)."), GetLastError());
if (CredDelete(m_cred_storage.target_name(m_prov.get_id().c_str(), m_cfg.m_level).c_str(), CRED_TYPE_GENERIC, 0)) {
m_storage_identity->SetLabel(wxEmptyString);
m_cred_storage.clear();
m_has_storage = false;
} else
wxLogError(_("Deleting credentials failed (error %u)."), GetLastError());
m_timer_storage.Start(3000);
}
virtual void OnSetConfig(wxCommandEvent& event)
{
wxEAPCredentialsConfigPanelBase::OnSetConfig(event);
wxEAPCredentialsDialog dlg(m_prov, this);
_wxT *panel = new _wxT(m_prov, m_cfg, m_cred_config, &dlg, true);
dlg.AddContent(panel);
if (dlg.ShowModal() == wxID_OK)
m_timer_storage.Start(3000);
} else {
m_cred_config.clear();
UpdateConfigIdentity();
}
}
@ -931,7 +921,7 @@ protected:
UpdateStorageIdentity();
} catch (winstd::win_runtime_error &err) {
if (err.number() == ERROR_NOT_FOUND) {
m_storage_identity->SetLabel(wxEmptyString);
m_storage_identity->SetLabel(_("(none)"));
m_cred_storage.clear();
m_has_storage = false;
} else {
@ -1074,6 +1064,8 @@ public:
if (layout)
this->Layout();
m_identity->SetValidator(wxTextValidator(wxFILTER_EMPTY));
}
protected:
@ -1088,6 +1080,10 @@ protected:
// Credential prompt mode & Using configured credentials
m_identity_label->Enable(false);
m_identity ->Enable(false);
} else {
// Configuration mode or using stored credentials. Enable controls.
m_identity_label->Enable(true);
m_identity ->Enable(true);
}
return wxEAPCredentialsPanel<_Tcred, _Tbase>::TransferDataToWindow();
@ -1136,6 +1132,8 @@ public:
m_password_label->SetLabel(m_prov.m_lbl_alt_password);
this->Layout();
}
m_password->SetValidator(wxTextValidator(wxFILTER_EMPTY));
}
protected:
@ -1150,6 +1148,10 @@ protected:
// Credential prompt mode & Using configured credentials
m_password_label->Enable(false);
m_password ->Enable(false);
} else {
// Configuration mode or using stored credentials. Enable controls.
m_password_label->Enable(true);
m_password ->Enable(true);
}
return wxIdentityCredentialsPanel<_Tcred, _Tbase>::TransferDataToWindow();

View File

@ -241,88 +241,63 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
m_credentials_label->Wrap( FromDIP(440) );
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, FromDIP(5) );
m_storage = new wxRadioButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Use from Credential &Manager"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_storage->SetToolTip( _("Select this option if you would like to use credentials stored in Windows Credential Manager") );
sb_credentials_vert->Add( m_storage, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, FromDIP(5) );
wxBoxSizer* sb_credentials_radio;
sb_credentials_radio = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* sb_storage;
sb_storage = new wxBoxSizer( wxVERTICAL );
sb_storage = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* sb_storage_identity;
sb_storage_identity = new wxBoxSizer( wxHORIZONTAL );
m_storage = new wxRadioButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Use from Credential &Manager:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_storage->SetToolTip( _("Select this option if you would like to use credentials stored in Windows Credential Manager") );
m_storage_identity_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Identity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_storage_identity_label->Wrap( -1 );
sb_storage_identity->Add( m_storage_identity_label, 0, 0, FromDIP(5) );
sb_storage->Add( m_storage, 0, wxEXPAND, FromDIP(5) );
m_storage_identity = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_storage_identity->Wrap( -1 );
m_storage_identity->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_storage_identity->SetToolTip( _("Your present credentials stored in Windows Credential Manager") );
sb_storage_identity->Add( m_storage_identity, 1, wxEXPAND|wxLEFT, FromDIP(5) );
sb_storage->Add( m_storage_identity, 1, wxEXPAND, FromDIP(5) );
sb_storage->Add( sb_storage_identity, 1, wxEXPAND, FromDIP(5) );
wxBoxSizer* sb_buttons_storage;
sb_buttons_storage = new wxBoxSizer( wxHORIZONTAL );
m_storage_clear = new wxButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Clear Credentials"), wxDefaultPosition, wxDefaultSize, 0 );
m_storage_clear->SetToolTip( _("Click to clear your credentials from Credential Manager.\nNote: You will be prompted to enter credentials when connecting.") );
sb_buttons_storage->Add( m_storage_clear, 0, wxRIGHT, FromDIP(5) );
m_storage_set = new wxButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 );
m_storage_set->SetToolTip( _("Click here to set or modify your credentials") );
sb_buttons_storage->Add( m_storage_set, 0, wxLEFT, FromDIP(5) );
sb_storage->Add( sb_buttons_storage, 0, wxALIGN_RIGHT|wxTOP, FromDIP(5) );
sb_credentials_vert->Add( sb_storage, 0, wxEXPAND|wxALL, FromDIP(5) );
m_config = new wxRadioButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Use from &profile configuration"), wxDefaultPosition, wxDefaultSize, 0 );
m_config->SetToolTip( _("Select this option if you would like to store credentials as a part of profile configuration") );
sb_credentials_vert->Add( m_config, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, FromDIP(5) );
sb_credentials_radio->Add( sb_storage, 1, wxEXPAND|wxBOTTOM, FromDIP(5) );
wxBoxSizer* sb_config;
sb_config = new wxBoxSizer( wxVERTICAL );
sb_config = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* sb_config_identity;
sb_config_identity = new wxBoxSizer( wxHORIZONTAL );
m_config = new wxRadioButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Use from &profile configuration:"), wxDefaultPosition, wxDefaultSize, 0 );
m_config->SetToolTip( _("Select this option if you would like to store credentials as a part of profile configuration") );
m_config_identity_label = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, _("Identity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_config_identity_label->Wrap( -1 );
sb_config_identity->Add( m_config_identity_label, 0, 0, FromDIP(5) );
sb_config->Add( m_config, 0, wxEXPAND, FromDIP(5) );
m_config_identity = new wxStaticText( m_sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_config_identity->Wrap( -1 );
m_config_identity->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_config_identity->SetToolTip( _("Profile configuration credentials") );
sb_config_identity->Add( m_config_identity, 1, wxEXPAND|wxLEFT, FromDIP(5) );
sb_config->Add( m_config_identity, 1, wxEXPAND, FromDIP(5) );
sb_config->Add( sb_config_identity, 1, wxEXPAND, FromDIP(5) );
wxBoxSizer* sb_buttons_config;
sb_buttons_config = new wxBoxSizer( wxHORIZONTAL );
m_config_set = new wxButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 );
m_config_set->SetToolTip( _("Click here to set or modify your credentials") );
sb_buttons_config->Add( m_config_set, 0, 0, FromDIP(5) );
sb_credentials_radio->Add( sb_config, 1, wxEXPAND|wxTOP, FromDIP(5) );
sb_config->Add( sb_buttons_config, 0, wxALIGN_RIGHT|wxTOP, FromDIP(5) );
sb_credentials_vert->Add( sb_credentials_radio, 0, wxEXPAND|wxALL, FromDIP(5) );
wxBoxSizer* sb_buttons_storage;
sb_buttons_storage = new wxBoxSizer( wxHORIZONTAL );
m_clear = new wxButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Clear Credentials"), wxDefaultPosition, wxDefaultSize, 0 );
m_clear->SetToolTip( _("Click to clear your credentials from Credential Manager.\nNote: You will be prompted to enter credentials when connecting.") );
sb_buttons_storage->Add( m_clear, 0, wxRIGHT, FromDIP(5) );
m_set = new wxButton( m_sb_credentials->GetStaticBox(), wxID_ANY, _("&Set Credentials..."), wxDefaultPosition, wxDefaultSize, 0 );
m_set->SetToolTip( _("Click here to set or modify your credentials") );
sb_buttons_storage->Add( m_set, 0, wxLEFT, FromDIP(5) );
sb_credentials_vert->Add( sb_config, 0, wxEXPAND|wxALL, FromDIP(5) );
sb_credentials_vert->Add( sb_buttons_storage, 0, wxALIGN_RIGHT|wxTOP, FromDIP(5) );
sb_credentials_horiz->Add( sb_credentials_vert, 1, wxEXPAND, FromDIP(5) );
@ -337,9 +312,8 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
m_storage_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearStorage ), NULL, this );
m_storage_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetStorage ), NULL, this );
m_config_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetConfig ), NULL, this );
m_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClear ), NULL, this );
m_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSet ), NULL, this );
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerStorage ) );
}
@ -347,9 +321,8 @@ wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
m_storage_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearStorage ), NULL, this );
m_storage_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetStorage ), NULL, this );
m_config_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetConfig ), NULL, this );
m_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClear ), NULL, this );
m_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSet ), NULL, this );
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerStorage ) );
}

View File

@ -1157,93 +1157,29 @@
<property name="wrap">440</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use from Credential &amp;Manager</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_storage</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRB_GROUP</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select this option if you would like to use credentials stored in Windows Credential Manager</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_storage</property>
<property name="name">sb_credentials_radio</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_storage_identity</property>
<property name="name">sb_storage</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1271,8 +1207,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Identity:</property>
<property name="markup">0</property>
<property name="label">Use from Credential &amp;Manager:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1280,7 +1215,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_storage_identity_label</property>
<property name="name">m_storage</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1290,19 +1225,23 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxRB_GROUP</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Select this option if you would like to use credentials stored in Windows Credential Manager</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -1365,250 +1304,18 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_buttons_storage</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Clear Credentials</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_storage_clear</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Click to clear your credentials from Credential Manager.&#x0A;Note: You will be prompted to enter credentials when connecting.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnClearStorage</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Set Credentials...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_storage_set</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Click here to set or modify your credentials</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSetStorage</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use from &amp;profile configuration</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_config</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select this option if you would like to store credentials as a part of profile configuration</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_config</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_config_identity</property>
<property name="name">sb_config</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1636,8 +1343,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Identity:</property>
<property name="markup">0</property>
<property name="label">Use from &amp;profile configuration:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1645,7 +1351,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_config_identity_label</property>
<property name="name">m_config</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1658,16 +1364,20 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Select this option if you would like to store credentials as a part of profile configuration</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -1728,88 +1438,161 @@
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sb_buttons_storage</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxTOP</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Clear Credentials</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="name">sb_buttons_config</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Set Credentials...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_config_set</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Click here to set or modify your credentials</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSetConfig</event>
</object>
</object>
<property name="moveable">1</property>
<property name="name">m_clear</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Click to clear your credentials from Credential Manager.&#x0A;Note: You will be prompted to enter credentials when connecting.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnClear</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Set Credentials...</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_set</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Click here to set or modify your credentials</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSet</event>
</object>
</object>
</object>

View File

@ -166,21 +166,17 @@ class wxEAPCredentialsConfigPanelBase : public wxPanel
wxStaticBitmap* m_credentials_icon;
wxStaticText* m_credentials_label;
wxRadioButton* m_storage;
wxStaticText* m_storage_identity_label;
wxStaticText* m_storage_identity;
wxButton* m_storage_clear;
wxButton* m_storage_set;
wxRadioButton* m_config;
wxStaticText* m_config_identity_label;
wxStaticText* m_config_identity;
wxButton* m_config_set;
wxButton* m_clear;
wxButton* m_set;
wxTimer m_timer_storage;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnClearStorage( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetStorage( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetConfig( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClear( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSet( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTimerStorage( wxTimerEvent& event ) { event.Skip(); }

View File

@ -37,6 +37,7 @@
class wxCertificateClientData;
class wxCertificateHashClientData;
class wxCertificateValidator;
class wxTLSCredentialsPanel;
class wxTLSServerTrustPanel;
class wxTLSConfigPanel;
@ -104,6 +105,51 @@ public:
};
///
/// User certificate validator - checks if a (valid) user certificate is selected
///
class wxCertificateValidator : public wxValidator
{
public:
///
/// Construct the validator with a value to store data
///
wxCertificateValidator(wxCertificateHashClientData *val = NULL);
///
/// Copies this validator
///
virtual wxObject* Clone() const;
///
/// Validates the value
///
virtual bool Validate(wxWindow *parent);
///
/// Transfers the value to the window
///
virtual bool TransferToWindow();
///
/// Transfers the value from the window
///
virtual bool TransferFromWindow();
///
/// Parses FQDN list value
///
static bool Parse(const wxCertificateHashClientData *val_in, wxChoice *ctrl, wxWindow *parent, wxCertificateHashClientData *val_out = NULL);
protected:
wxCertificateHashClientData *m_val; ///< Pointer to variable to receive control's parsed value
private:
wxDECLARE_DYNAMIC_CLASS(wxCertificateValidator);
wxDECLARE_NO_ASSIGN_CLASS(wxCertificateValidator);
};
///
/// TLS credential panel
///
@ -127,6 +173,9 @@ protected:
virtual bool TransferDataFromWindow();
virtual void OnUpdateUI(wxUpdateUIEvent& event);
/// \endcond
protected:
wxCertificateHashClientData m_certificate_val; ///< Client certificate hash value
};

View File

@ -39,6 +39,91 @@ wxCertificateClientData::~wxCertificateClientData()
}
//////////////////////////////////////////////////////////////////////
// wxCertificateValidator
//////////////////////////////////////////////////////////////////////
wxIMPLEMENT_DYNAMIC_CLASS(wxCertificateValidator, wxValidator);
wxCertificateValidator::wxCertificateValidator(wxCertificateHashClientData *val) :
m_val(val),
wxValidator()
{
}
wxObject* wxCertificateValidator::Clone() const
{
return new wxCertificateValidator(*this);
}
bool wxCertificateValidator::Validate(wxWindow *parent)
{
wxChoice *ctrl = (wxChoice*)GetWindow();
if (!ctrl || !ctrl->IsEnabled()) return true;
int sel = ctrl->GetSelection();
const wxCertificateHashClientData *val =
sel != wxNOT_FOUND && ctrl->HasClientObjectData() ?
dynamic_cast<const wxCertificateHashClientData*>(ctrl->GetClientObject(sel)) :
NULL;
return Parse(val, ctrl, parent);
}
bool wxCertificateValidator::TransferToWindow()
{
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxChoice)));
wxChoice *ctrl = (wxChoice*)GetWindow();
if (m_val) {
if (ctrl->HasClientObjectData()) {
for (unsigned int i = 0, n = ctrl->GetCount(); i < n; i++) {
const wxCertificateHashClientData *val = dynamic_cast<const wxCertificateHashClientData*>(ctrl->GetClientObject(i));
if (val && m_val->m_cert_hash == val->m_cert_hash) {
ctrl->SetSelection(i);
return true;
}
}
}
ctrl->SetSelection(wxNOT_FOUND);
}
return true;
}
bool wxCertificateValidator::TransferFromWindow()
{
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxChoice)));
wxChoice *ctrl = (wxChoice*)GetWindow();
int sel = ctrl->GetSelection();
const wxCertificateHashClientData *val =
sel != wxNOT_FOUND && ctrl->HasClientObjectData() ?
dynamic_cast<const wxCertificateHashClientData*>(ctrl->GetClientObject(sel)) :
NULL;
return Parse(val, ctrl, NULL, m_val);
}
bool wxCertificateValidator::Parse(const wxCertificateHashClientData *val_in, wxChoice *ctrl, wxWindow *parent, wxCertificateHashClientData *val_out)
{
if (!val_in) {
ctrl->SetFocus();
wxMessageBox(_("No certificate selected"), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
return false;
}
if (val_out) val_out->m_cert_hash = val_in->m_cert_hash;
return true;
}
//////////////////////////////////////////////////////////////////////
// wxTLSCredentialsPanel
//////////////////////////////////////////////////////////////////////
@ -50,16 +135,8 @@ wxTLSCredentialsPanel::wxTLSCredentialsPanel(const eap::config_provider &prov, c
winstd::library lib_shell32;
if (lib_shell32.load(_T("certmgr.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
m_credentials_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(6170)));
}
/// \cond internal
bool wxTLSCredentialsPanel::TransferDataToWindow()
{
// Populate certificate list.
m_certificate->Append(_("(none)"), (wxCertificateHashClientData*)NULL);
bool is_found = false;
winstd::cert_store store;
if (store.create(CERT_STORE_PROV_SYSTEM, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, _T("My"))) {
for (PCCERT_CONTEXT cert = NULL; (cert = CertEnumCertificatesInStore(store, cert)) != NULL;) {
@ -77,18 +154,21 @@ bool wxTLSCredentialsPanel::TransferDataToWindow()
}
// Add to list.
bool is_selected = m_cred.m_cert_hash == data->m_cert_hash;
winstd::tstring name(std::move(eap::get_cert_title(cert)));
int i = m_certificate->Append(name, data.release());
if (is_selected) {
m_certificate->SetSelection(i);
is_found = true;
}
m_certificate->Append(name, data.release());
}
}
if (!is_found)
m_certificate->SetSelection(0);
m_certificate->SetValidator(wxCertificateValidator(&m_certificate_val));
}
/// \cond internal
bool wxTLSCredentialsPanel::TransferDataToWindow()
{
// Set client certificate hash. The wxChoice control will set selection using validator.
m_certificate_val.m_cert_hash = m_cred.m_cert_hash;
m_identity->SetValue(m_cred.m_identity);
@ -98,22 +178,13 @@ bool wxTLSCredentialsPanel::TransferDataToWindow()
bool wxTLSCredentialsPanel::TransferDataFromWindow()
{
// Check if m_certificate control has selected item, and has client object data (at least one user certificate on the list). Then try to get the data from selected item.
int sel = m_certificate->GetSelection();
const wxCertificateHashClientData *data =
sel != wxNOT_FOUND && m_certificate->HasClientObjectData() ?
dynamic_cast<const wxCertificateHashClientData*>(m_certificate->GetClientObject(sel)) :
NULL;
if (data)
m_cred.m_cert_hash = data->m_cert_hash;
else
m_cred.m_cert_hash.clear();
if (!wxEAPCredentialsPanel<eap::credentials_tls, wxTLSCredentialsPanelBase>::TransferDataFromWindow())
return false;
m_cred.m_identity = m_identity->GetValue();
m_cred.m_cert_hash = m_certificate_val.m_cert_hash;
m_cred.m_identity = m_identity->GetValue();
// Inherited TransferDataFromWindow() calls m_cred.store().
// Therefore, call it only now, that m_cred is set.
return wxEAPCredentialsPanel<eap::credentials_tls, wxTLSCredentialsPanelBase>::TransferDataFromWindow();
return true;
}