eap::config_provider detemplatization
This commit is contained in:
parent
780b738842
commit
a7d75ea72d
@ -23,7 +23,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace winstd;
|
using namespace winstd;
|
||||||
|
|
||||||
eap::module g_module(eap::type_undefined);
|
eap::peer_base<eap::config_method_pap, eap::credentials_pap, void, void> g_module(eap::type_undefined);
|
||||||
|
|
||||||
|
|
||||||
static int CredWrite()
|
static int CredWrite()
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../lib/PAP/include/Config.h"
|
||||||
#include "../lib/PAP/include/Credentials.h"
|
#include "../lib/PAP/include/Credentials.h"
|
||||||
#include "../lib/EAPBase/include/Module.h"
|
#include "../lib/EAPBase/include/Module.h"
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ namespace eap
|
|||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Makes new set of credentials for the given method type
|
/// Makes a new set of credentials for the given method type
|
||||||
///
|
///
|
||||||
virtual credentials* make_credentials() const = 0;
|
virtual credentials* make_credentials() const = 0;
|
||||||
|
|
||||||
@ -356,8 +356,8 @@ namespace eap
|
|||||||
m_lbl_alt_password(other.m_lbl_alt_password),
|
m_lbl_alt_password(other.m_lbl_alt_password),
|
||||||
config(other)
|
config(other)
|
||||||
{
|
{
|
||||||
for (std::list<std::unique_ptr<_Tmeth> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
for (std::list<std::unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
||||||
m_methods.push_back(std::move(std::unique_ptr<_Tmeth>(*method ? (_Tmeth*)method->get()->clone() : nullptr)));
|
m_methods.push_back(std::move(std::unique_ptr<config_method>(*method ? (config_method*)method->get()->clone() : nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -402,8 +402,8 @@ namespace eap
|
|||||||
m_lbl_alt_password = other.m_lbl_alt_password;
|
m_lbl_alt_password = other.m_lbl_alt_password;
|
||||||
|
|
||||||
m_methods.clear();
|
m_methods.clear();
|
||||||
for (std::list<std::unique_ptr<_Tmeth> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
for (std::list<std::unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
||||||
m_methods.push_back(std::move(std::unique_ptr<_Tmeth>(*method ? (_Tmeth*)method->get()->clone() : nullptr)));
|
m_methods.push_back(std::move(std::unique_ptr<config_method>(*method ? (config_method*)method->get()->clone() : nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -548,7 +548,7 @@ namespace eap
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::list<std::unique_ptr<_Tmeth> >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) {
|
for (std::list<std::unique_ptr<config_method> >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) {
|
||||||
// <AuthenticationMethod>
|
// <AuthenticationMethod>
|
||||||
winstd::com_obj<IXMLDOMElement> pXmlElAuthenticationMethod;
|
winstd::com_obj<IXMLDOMElement> pXmlElAuthenticationMethod;
|
||||||
if ((dwResult = eapxml::create_element(pDoc, winstd::bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod))) {
|
if ((dwResult = eapxml::create_element(pDoc, winstd::bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod))) {
|
||||||
@ -661,7 +661,7 @@ namespace eap
|
|||||||
winstd::com_obj<IXMLDOMNode> pXmlElMethod;
|
winstd::com_obj<IXMLDOMNode> pXmlElMethod;
|
||||||
pXmlListMethods->get_item(i, &pXmlElMethod);
|
pXmlListMethods->get_item(i, &pXmlElMethod);
|
||||||
|
|
||||||
std::unique_ptr<_Tmeth> cfg(new _Tmeth(m_module));
|
std::unique_ptr<config_method> cfg(m_module.make_config_method());
|
||||||
|
|
||||||
// Check EAP method type (<EAPMethod>).
|
// Check EAP method type (<EAPMethod>).
|
||||||
DWORD dwMethodID;
|
DWORD dwMethodID;
|
||||||
@ -749,14 +749,14 @@ namespace eap
|
|||||||
eapserial::unpack(cursor, m_lbl_alt_identity );
|
eapserial::unpack(cursor, m_lbl_alt_identity );
|
||||||
eapserial::unpack(cursor, m_lbl_alt_password );
|
eapserial::unpack(cursor, m_lbl_alt_password );
|
||||||
|
|
||||||
std::list<_Tmeth>::size_type count;
|
std::list<config_method>::size_type count;
|
||||||
bool is_nonnull;
|
bool is_nonnull;
|
||||||
eapserial::unpack(cursor, count);
|
eapserial::unpack(cursor, count);
|
||||||
m_methods.clear();
|
m_methods.clear();
|
||||||
for (std::list<_Tmeth>::size_type i = 0; i < count; i++) {
|
for (std::list<config_method>::size_type i = 0; i < count; i++) {
|
||||||
eapserial::unpack(cursor, is_nonnull);
|
eapserial::unpack(cursor, is_nonnull);
|
||||||
if (is_nonnull) {
|
if (is_nonnull) {
|
||||||
std::unique_ptr<_Tmeth> el(new _Tmeth(m_module));
|
std::unique_ptr<config_method> el(m_module.make_config_method());
|
||||||
el->unpack(cursor);
|
el->unpack(cursor);
|
||||||
m_methods.push_back(std::move(el));
|
m_methods.push_back(std::move(el));
|
||||||
} else
|
} else
|
||||||
@ -776,7 +776,7 @@ namespace eap
|
|||||||
winstd::tstring m_lbl_alt_credential; ///< Alternative label for credential prompt
|
winstd::tstring m_lbl_alt_credential; ///< Alternative label for credential prompt
|
||||||
winstd::tstring m_lbl_alt_identity; ///< Alternative label for identity prompt
|
winstd::tstring m_lbl_alt_identity; ///< Alternative label for identity prompt
|
||||||
winstd::tstring m_lbl_alt_password; ///< Alternative label for password prompt
|
winstd::tstring m_lbl_alt_password; ///< Alternative label for password prompt
|
||||||
std::list<std::unique_ptr<_Tmeth> > m_methods; ///< List of method configurations
|
std::list<std::unique_ptr<config_method> > m_methods; ///< List of method configurations
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +96,11 @@ namespace eap
|
|||||||
///
|
///
|
||||||
void free_error_memory(_In_ EAP_ERROR *err);
|
void free_error_memory(_In_ EAP_ERROR *err);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Makes a new method config for the given method type
|
||||||
|
///
|
||||||
|
virtual config_method* make_config_method() = 0;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// \name Logging
|
/// \name Logging
|
||||||
@ -693,6 +698,14 @@ namespace eap
|
|||||||
/// Constructs a EAP peer module for the given EAP type
|
/// Constructs a EAP peer module for the given EAP type
|
||||||
///
|
///
|
||||||
peer_base(_In_ type_t eap_method) : module(eap_method) {}
|
peer_base(_In_ type_t eap_method) : module(eap_method) {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Makes a new method config for the given method type
|
||||||
|
///
|
||||||
|
virtual config_method* make_config_method()
|
||||||
|
{
|
||||||
|
return new config_method_type(*this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ public:
|
|||||||
|
|
||||||
for (std::list<_Tprov>::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
|
for (std::list<_Tprov>::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
|
||||||
bool is_single = provider->m_methods.size() == 1;
|
bool is_single = provider->m_methods.size() == 1;
|
||||||
std::list<std::unique_ptr<_Tmeth> >::size_type count = 0;
|
std::list<std::unique_ptr<eap::config_method> >::size_type count = 0;
|
||||||
std::list<std::unique_ptr<_Tmeth> >::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end();
|
std::list<std::unique_ptr<eap::config_method> >::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end();
|
||||||
for (; method != method_end; ++method, count++)
|
for (; method != method_end; ++method, count++)
|
||||||
m_providers->AddPage(
|
m_providers->AddPage(
|
||||||
new _wxT(
|
new _wxT(
|
||||||
|
@ -139,9 +139,9 @@ public:
|
|||||||
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
/// \param[in] pszCredTarget Target name of credentials in Windows Credential Manager. Can be further decorated to create final target name.
|
||||||
/// \param[in] parent Parent window
|
/// \param[in] parent Parent window
|
||||||
///
|
///
|
||||||
wxTTLSConfigWindow(_Tprov &prov, eap::config_method_ttls &cfg, LPCTSTR pszCredTarget, wxWindow* parent) :
|
wxTTLSConfigWindow(_Tprov &prov, eap::config_method &cfg, LPCTSTR pszCredTarget, wxWindow* parent) :
|
||||||
m_prov(prov),
|
m_prov(prov),
|
||||||
m_cfg(cfg),
|
m_cfg((eap::config_method_ttls&)cfg),
|
||||||
m_cfg_pap(cfg.m_module),
|
m_cfg_pap(cfg.m_module),
|
||||||
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
||||||
{
|
{
|
||||||
@ -269,5 +269,6 @@ protected:
|
|||||||
wxStaticText *m_inner_title; ///< Inner authentication title
|
wxStaticText *m_inner_title; ///< Inner authentication title
|
||||||
wxChoicebook *m_inner_type; ///< Inner authentication type
|
wxChoicebook *m_inner_type; ///< Inner authentication type
|
||||||
|
|
||||||
eap::config_method_pap m_cfg_pap; ///< Temporary PAP configuration
|
// Temprary inner method configurations to hold data until applied
|
||||||
|
eap::config_method_pap m_cfg_pap; ///< PAP configuration
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user