config_method_ttls: Split to make reusable

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2020-01-14 15:30:14 +01:00
parent a943a14d0f
commit 248e15641a
10 changed files with 195 additions and 88 deletions

View File

@@ -22,6 +22,7 @@
namespace eap
{
class config_method_tls_tunnel;
class config_method_ttls;
}
@@ -44,9 +45,91 @@ namespace eap
/// @{
///
/// TTLS configuration
/// TLS tunnel configuration
///
class config_method_ttls : public config_method_tls
class config_method_tls_tunnel : public config_method_tls
{
public:
///
/// Constructs configuration
///
/// \param[in] mod EAP module to use for global services
/// \param[in] level Config level (0=outer, 1=inner, 2=inner-inner...)
///
config_method_tls_tunnel(_In_ module &mod, _In_ unsigned int level);
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
config_method_tls_tunnel(const _In_ config_method_tls_tunnel &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
config_method_tls_tunnel(_Inout_ config_method_tls_tunnel &&other) noexcept;
///
/// Copies configuration
///
/// \param[in] other Configuration to copy from
///
/// \returns Reference to this object
///
config_method_tls_tunnel& operator=(const _In_ config_method_tls_tunnel &other);
///
/// Moves configuration
///
/// \param[in] other Configuration to move from
///
/// \returns Reference to this object
///
config_method_tls_tunnel& operator=(_Inout_ config_method_tls_tunnel &&other) noexcept;
/// \name BLOB management
/// @{
virtual void operator<<(_Inout_ cursor_out &cursor) const;
virtual size_t get_pk_size() const;
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_tls_tunnel` type of credentials
///
virtual credentials* make_credentials() const;
///
/// Makes a new inner method config
///
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const = 0;
///
/// Makes a new inner method config
///
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const = 0;
public:
std::unique_ptr<config_method> m_inner; ///< Inner authentication configuration
};
///
/// EAP-TTLS configuration
///
class config_method_ttls : public config_method_tls_tunnel
{
public:
///
@@ -97,13 +180,6 @@ namespace eap
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
/// @}
/// \name BLOB management
/// @{
virtual void operator<<(_Inout_ cursor_out &cursor) const;
virtual size_t get_pk_size() const;
virtual void operator>>(_Inout_ cursor_in &cursor);
/// @}
///
/// @copydoc eap::config_method::get_method_id()
/// \returns This implementation always returns `winstd::eap_type_t::ttls`
@@ -117,10 +193,13 @@ namespace eap
virtual const wchar_t* get_method_str() const;
///
/// @copydoc eap::config_method::make_credentials()
/// \returns This implementation always returns `eap::credentials_tls_tunnel` type of credentials
/// Makes a new inner method config
///
virtual credentials* make_credentials() const;
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
virtual config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const;
///
/// Makes a new inner method config
@@ -129,19 +208,7 @@ namespace eap
///
/// \returns A new inner method config of given type
///
config_method* make_config_method(_In_ winstd::eap_type_t eap_type) const;
///
/// Makes a new inner method config
///
/// \param[in] eap_type EAP type
///
/// \returns A new inner method config of given type
///
config_method* make_config_method(_In_ const wchar_t *eap_type) const;
public:
std::unique_ptr<config_method> m_inner; ///< Inner authentication configuration
virtual config_method* make_config_method(_In_ const wchar_t *eap_type) const;
};
/// @}