diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index 3077039..120da48 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -770,7 +770,7 @@ protected: private: bool m_has_storage; ///< Does the user has (some sort of) credentials stored in Credential Manager? - _Tcred m_cred_storage; ///< Temporary own credential data + _Tcred m_cred_storage; ///< Temporary stored credential data _Tcred m_cred_config; ///< Temporary config credential data }; @@ -791,7 +791,7 @@ public: /// \param[in] cfg Configuration data /// \param[inout] cred Credentials data /// \param[in] parent Parent window - /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. + /// \param[in] is_config Is this panel used to config credentials? /// wxEAPCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) : m_prov(prov), @@ -841,7 +841,7 @@ public: /// \param[in] cfg Configuration data /// \param[inout] cred Credentials data /// \param[in] parent Parent window - /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. + /// \param[in] is_config Is this panel used to config credentials? /// wxPasswordCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) : wxEAPCredentialsPanel<_Tcred, _Tbase>(prov, cfg, cred, parent, is_config) diff --git a/lib/EAPBase_UI/res/wxEAP_UI.fbp b/lib/EAPBase_UI/res/wxEAP_UI.fbp index fb00621..32cd370 100644 --- a/lib/EAPBase_UI/res/wxEAP_UI.fbp +++ b/lib/EAPBase_UI/res/wxEAP_UI.fbp @@ -46,7 +46,7 @@ wxDEFAULT_DIALOG_STYLE - ; + EAP Connection Configuration @@ -596,7 +596,7 @@ wxDEFAULT_DIALOG_STYLE - ; + @@ -787,7 +787,7 @@ wxDEFAULT_DIALOG_STYLE - ; + EAP Credentials diff --git a/lib/TLS_UI/include/TLS_UI.h b/lib/TLS_UI/include/TLS_UI.h index 3668367..4867708 100644 --- a/lib/TLS_UI/include/TLS_UI.h +++ b/lib/TLS_UI/include/TLS_UI.h @@ -68,7 +68,7 @@ class wxTLSServerTrustPanel; /// /// TLS credentials configuration panel /// -typedef wxEAPCredentialsConfigPanel wxEAPCredentialsPromptTLSConfigPanel; +typedef wxEAPCredentialsConfigPanel wxTLSCredentialsConfigPanel; /// /// TLS configuration panel @@ -258,7 +258,7 @@ public: /// \param[in] cfg Configuration data /// \param[inout] cred Credentials data /// \param[in] parent Parent window - /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. + /// \param[in] is_config Is this panel used to config credentials? /// wxTLSCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, eap::credentials_tls &cred, wxWindow* parent, bool is_config = false); @@ -330,8 +330,8 @@ protected: /// \endcond protected: - const eap::config_provider &m_prov; ///< EAP provider - eap::config_method_tls &m_cfg; ///< TLS configuration - wxTLSServerTrustPanel *m_server_trust; ///< Server trust configuration panel - wxEAPCredentialsPromptTLSConfigPanel *m_credentials; ///< Credentials configuration panel + const eap::config_provider &m_prov; ///< EAP provider + eap::config_method_tls &m_cfg; ///< TLS configuration + wxTLSServerTrustPanel *m_server_trust; ///< Server trust configuration panel + wxTLSCredentialsConfigPanel *m_credentials; ///< Credentials configuration panel }; diff --git a/lib/TLS_UI/res/wxTLS_UI.fbp b/lib/TLS_UI/res/wxTLS_UI.fbp index 76a223e..b70a3ee 100644 --- a/lib/TLS_UI/res/wxTLS_UI.fbp +++ b/lib/TLS_UI/res/wxTLS_UI.fbp @@ -1293,7 +1293,7 @@ 1 wxCB_SORT - ; + 0 Client certificate to use for authentication diff --git a/lib/TLS_UI/src/TLS_UI.cpp b/lib/TLS_UI/src/TLS_UI.cpp index 6324b99..edfbee5 100644 --- a/lib/TLS_UI/src/TLS_UI.cpp +++ b/lib/TLS_UI/src/TLS_UI.cpp @@ -384,7 +384,7 @@ void wxTLSCredentialsPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/) m_certificate->Enable(false); m_identity ->Enable(false); } else { - // Configuration mode or using own credentials. Enable controls. + // Configuration mode or using stored credentials. Enable controls. m_certificate->Enable(true); m_identity ->Enable(true); } @@ -563,7 +563,7 @@ wxTLSConfigPanel::wxTLSConfigPanel(const eap::config_provider &prov, eap::config m_server_trust = new wxTLSServerTrustPanel(prov, cfg, this); sb_content->Add(m_server_trust, 0, wxDOWN|wxEXPAND, 5); - m_credentials = new wxEAPCredentialsPromptTLSConfigPanel(prov, cfg, this); + m_credentials = new wxTLSCredentialsConfigPanel(prov, cfg, this); sb_content->Add(m_credentials, 0, wxUP|wxEXPAND, 5); this->SetSizer(sb_content); diff --git a/lib/TTLS_UI/include/TTLS_UI.h b/lib/TTLS_UI/include/TTLS_UI.h index 641347d..0007799 100644 --- a/lib/TTLS_UI/include/TTLS_UI.h +++ b/lib/TTLS_UI/include/TTLS_UI.h @@ -18,6 +18,11 @@ along with GÉANTLink. If not, see . */ +/// +/// TTLS credential panel +/// +class wxTTLSCredentialsPanel; + /// /// TTLS configuration panel /// @@ -28,11 +33,6 @@ class wxTTLSConfigPanel; /// class wxTTLSConfigWindow; -/// -/// TTLS credential panel -/// -class wxTTLSCredentialsPanel; - #pragma once #include "../res/wxTTLS_UI.h" @@ -52,6 +52,42 @@ class wxTTLSCredentialsPanel; #include +class wxTTLSCredentialsPanel : public wxPanel +{ +public: + /// + /// Constructs a configuration panel + /// + /// \param[in] prov Provider configuration data + /// \param[in] cfg Configuration data + /// \param[inout] cred Credentials data + /// \param[in] parent Parent window + /// \param[in] is_config Is this panel used to config credentials? + /// + wxTTLSCredentialsPanel(const eap::config_provider &prov, const eap::config_method_ttls &cfg, eap::credentials_ttls &cred, wxWindow* parent, bool is_config = false); + + /// + /// Destructs the configuration panel + /// + virtual ~wxTTLSCredentialsPanel(); + +protected: + /// \cond internal + virtual void OnInitDialog(wxInitDialogEvent& event); + /// \endcond + +public: + wxTLSCredentialsPanel *m_outer_cred; ///< Outer credentials panel + wxEAPCredentialsPanelBase *m_inner_cred; ///< Inner credentials panel + +protected: + const eap::config_provider &m_prov; ///< EAP provider + const eap::config_method_ttls &m_cfg; ///< TTLS configuration + wxStaticText *m_outer_title; ///< Outer authentication title + wxStaticText *m_inner_title; ///< Inner authentication title +}; + + class wxTTLSConfigPanel : public wxTTLSConfigPanelBase { public: @@ -110,39 +146,3 @@ protected: eap::config_method_pap m_cfg_pap; ///< PAP configuration eap::config_method_mschapv2 m_cfg_mschapv2; ///< MSCHAPv2 configuration }; - - -class wxTTLSCredentialsPanel : public wxPanel -{ -public: - /// - /// Constructs a configuration panel - /// - /// \param[in] prov Provider configuration data - /// \param[in] cfg Configuration data - /// \param[inout] cred Credentials data - /// \param[in] parent Parent window - /// \param[in] is_config Is this panel used to pre-enter credentials? When \c true, the "Remember" checkbox is always selected and disabled. - /// - wxTTLSCredentialsPanel(const eap::config_provider &prov, const eap::config_method_ttls &cfg, eap::credentials_ttls &cred, wxWindow* parent, bool is_config = false); - - /// - /// Destructs the configuration panel - /// - virtual ~wxTTLSCredentialsPanel(); - -protected: - /// \cond internal - virtual void OnInitDialog(wxInitDialogEvent& event); - /// \endcond - -public: - wxTLSCredentialsPanel *m_outer_cred; ///< Outer credentials panel - wxEAPCredentialsPanelBase *m_inner_cred; ///< Inner credentials panel - -protected: - const eap::config_provider &m_prov; ///< EAP provider - const eap::config_method_ttls &m_cfg; ///< TTLS configuration - wxStaticText *m_outer_title; ///< Outer authentication title - wxStaticText *m_inner_title; ///< Inner authentication title -}; diff --git a/lib/TTLS_UI/src/TTLS_UI.cpp b/lib/TTLS_UI/src/TTLS_UI.cpp index 99f3bb6..27c0e7c 100644 --- a/lib/TTLS_UI/src/TTLS_UI.cpp +++ b/lib/TTLS_UI/src/TTLS_UI.cpp @@ -21,6 +21,79 @@ #include "StdAfx.h" +////////////////////////////////////////////////////////////////////// +// wxTTLSCredentialsPanel +////////////////////////////////////////////////////////////////////// + +wxTTLSCredentialsPanel::wxTTLSCredentialsPanel(const eap::config_provider &prov, const eap::config_method_ttls &cfg, eap::credentials_ttls &cred, wxWindow* parent, bool is_config) : + m_prov(prov), + m_cfg(cfg), + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) +{ + wxBoxSizer* sb_content; + sb_content = new wxBoxSizer( wxVERTICAL ); + + m_inner_title = new wxStaticText(this, wxID_ANY, _("Inner Authentication"), wxDefaultPosition, wxDefaultSize, 0); + m_inner_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString)); + m_inner_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); + sb_content->Add(m_inner_title, 0, wxALL|wxALIGN_RIGHT, 5); + + assert(m_cfg.m_inner); + + if (eap::config_method_with_cred::status_cred_begin <= m_cfg.m_inner->m_last_status && m_cfg.m_inner->m_last_status < eap::config_method_with_cred::status_cred_end) + sb_content->Add(new wxEAPCredentialWarningPanel(m_prov, m_cfg.m_inner->m_last_status, this), 0, wxALL|wxEXPAND, 5); + + const eap::config_method_pap *cfg_inner_pap; + const eap::config_method_mschapv2 *cfg_inner_mschapv2; + if ((cfg_inner_pap = dynamic_cast(m_cfg.m_inner.get())) != NULL) { + if (!cred.m_inner) cred.m_inner.reset(new eap::credentials_pass(cred.m_module)); + m_inner_cred = new wxPAPCredentialsPanel(m_prov, *cfg_inner_pap, *(eap::credentials_pass*)cred.m_inner.get(), this, is_config); + sb_content->Add(m_inner_cred, 0, wxALL|wxEXPAND, 5); + } else if ((cfg_inner_mschapv2 = dynamic_cast(m_cfg.m_inner.get())) != NULL) { + if (!cred.m_inner) cred.m_inner.reset(new eap::credentials_pass(cred.m_module)); + m_inner_cred = new wxMSCHAPv2CredentialsPanel(m_prov, *cfg_inner_mschapv2, *(eap::credentials_pass*)cred.m_inner.get(), this, is_config); + sb_content->Add(m_inner_cred, 0, wxALL|wxEXPAND, 5); + } else + assert(0); // Unsupported inner authentication method type. + + sb_content->Add(20, 20, 1, wxALL|wxEXPAND, 5); + + m_outer_title = new wxStaticText(this, wxID_ANY, _("Outer Authentication"), wxDefaultPosition, wxDefaultSize, 0); + m_outer_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString)); + m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); + sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5); + + if (eap::config_method_with_cred::status_cred_begin <= m_cfg.m_last_status && m_cfg.m_last_status < eap::config_method_with_cred::status_cred_end) + sb_content->Add(new wxEAPCredentialWarningPanel(m_prov, m_cfg.m_last_status, this), 0, wxALL|wxEXPAND, 5); + + m_outer_cred = new wxTLSCredentialsPanel(m_prov, m_cfg, cred, this, is_config); + sb_content->Add(m_outer_cred, 0, wxALL|wxEXPAND, 5); + + this->SetSizer(sb_content); + this->Layout(); + + m_inner_cred->SetFocusFromKbd(); + + // Connect Events + this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxTTLSCredentialsPanel::OnInitDialog)); +} + + +wxTTLSCredentialsPanel::~wxTTLSCredentialsPanel() +{ + // Disconnect Events + this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxTTLSCredentialsPanel::OnInitDialog)); +} + + +void wxTTLSCredentialsPanel::OnInitDialog(wxInitDialogEvent& event) +{ + // Forward the event to child panels. + m_outer_cred->GetEventHandler()->ProcessEvent(event); + m_inner_cred->GetEventHandler()->ProcessEvent(event); +} + + ////////////////////////////////////////////////////////////////////// // wxTTLSConfigPanel ////////////////////////////////////////////////////////////////////// @@ -218,76 +291,3 @@ void wxTTLSConfigWindow::OnUpdateUI(wxUpdateUIEvent& /*event*/) { m_inner_type->GetChoiceCtrl()->Enable(!m_prov.m_read_only); } - - -////////////////////////////////////////////////////////////////////// -// wxTTLSCredentialsPanel -////////////////////////////////////////////////////////////////////// - -wxTTLSCredentialsPanel::wxTTLSCredentialsPanel(const eap::config_provider &prov, const eap::config_method_ttls &cfg, eap::credentials_ttls &cred, wxWindow* parent, bool is_config) : - m_prov(prov), - m_cfg(cfg), - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) -{ - wxBoxSizer* sb_content; - sb_content = new wxBoxSizer( wxVERTICAL ); - - m_inner_title = new wxStaticText(this, wxID_ANY, _("Inner Authentication"), wxDefaultPosition, wxDefaultSize, 0); - m_inner_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString)); - m_inner_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); - sb_content->Add(m_inner_title, 0, wxALL|wxALIGN_RIGHT, 5); - - assert(m_cfg.m_inner); - - if (eap::config_method_with_cred::status_cred_begin <= m_cfg.m_inner->m_last_status && m_cfg.m_inner->m_last_status < eap::config_method_with_cred::status_cred_end) - sb_content->Add(new wxEAPCredentialWarningPanel(m_prov, m_cfg.m_inner->m_last_status, this), 0, wxALL|wxEXPAND, 5); - - const eap::config_method_pap *cfg_inner_pap; - const eap::config_method_mschapv2 *cfg_inner_mschapv2; - if ((cfg_inner_pap = dynamic_cast(m_cfg.m_inner.get())) != NULL) { - if (!cred.m_inner) cred.m_inner.reset(new eap::credentials_pass(cred.m_module)); - m_inner_cred = new wxPAPCredentialsPanel(m_prov, *cfg_inner_pap, *(eap::credentials_pass*)cred.m_inner.get(), this, is_config); - sb_content->Add(m_inner_cred, 0, wxALL|wxEXPAND, 5); - } else if ((cfg_inner_mschapv2 = dynamic_cast(m_cfg.m_inner.get())) != NULL) { - if (!cred.m_inner) cred.m_inner.reset(new eap::credentials_pass(cred.m_module)); - m_inner_cred = new wxMSCHAPv2CredentialsPanel(m_prov, *cfg_inner_mschapv2, *(eap::credentials_pass*)cred.m_inner.get(), this, is_config); - sb_content->Add(m_inner_cred, 0, wxALL|wxEXPAND, 5); - } else - assert(0); // Unsupported inner authentication method type. - - sb_content->Add(20, 20, 1, wxALL|wxEXPAND, 5); - - m_outer_title = new wxStaticText(this, wxID_ANY, _("Outer Authentication"), wxDefaultPosition, wxDefaultSize, 0); - m_outer_title->SetFont(wxFont(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString)); - m_outer_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INACTIVECAPTION ) ); - sb_content->Add(m_outer_title, 0, wxALL|wxALIGN_RIGHT, 5); - - if (eap::config_method_with_cred::status_cred_begin <= m_cfg.m_last_status && m_cfg.m_last_status < eap::config_method_with_cred::status_cred_end) - sb_content->Add(new wxEAPCredentialWarningPanel(m_prov, m_cfg.m_last_status, this), 0, wxALL|wxEXPAND, 5); - - m_outer_cred = new wxTLSCredentialsPanel(m_prov, m_cfg, cred, this, is_config); - sb_content->Add(m_outer_cred, 0, wxALL|wxEXPAND, 5); - - this->SetSizer(sb_content); - this->Layout(); - - m_inner_cred->SetFocusFromKbd(); - - // Connect Events - this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxTTLSCredentialsPanel::OnInitDialog)); -} - - -wxTTLSCredentialsPanel::~wxTTLSCredentialsPanel() -{ - // Disconnect Events - this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxTTLSCredentialsPanel::OnInitDialog)); -} - - -void wxTTLSCredentialsPanel::OnInitDialog(wxInitDialogEvent& event) -{ - // Forward the event to child panels. - m_outer_cred->GetEventHandler()->ProcessEvent(event); - m_inner_cred->GetEventHandler()->ProcessEvent(event); -}