config_method_ttls: Split to make reusable
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
@@ -117,7 +117,7 @@ namespace eap
|
||||
/// \param[in] dwFlags A combination of [EAP flags](https://msdn.microsoft.com/en-us/library/windows/desktop/bb891975.aspx) that describe the EAP authentication session behavior
|
||||
/// \param[in] hTokenImpersonateUser Impersonation token for a logged-on user to collect user-related information
|
||||
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL, must be `credentials_tls_tunnel*` type)
|
||||
/// \param[in] cfg Method configuration (unused, as must be as config_method_ttls is not derived from `config_method_with_cred`)
|
||||
/// \param[in] cfg Method configuration (unused, as must be as config_method_tls_tunnel is not derived from `config_method_with_cred`)
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
|
||||
///
|
||||
/// \returns
|
||||
|
@@ -190,7 +190,7 @@ namespace eap
|
||||
/// \param[in] cred User credentials
|
||||
/// \param[in] inner Inner method
|
||||
///
|
||||
method_ttls(_In_ module &mod, _In_ config_method_ttls &cfg, _In_ credentials_tls_tunnel &cred, _In_ method *inner);
|
||||
method_ttls(_In_ module &mod, _In_ config_method_tls_tunnel &cfg, _In_ credentials_tls_tunnel &cred, _In_ method *inner);
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
@@ -229,8 +229,8 @@ namespace eap
|
||||
#endif
|
||||
|
||||
protected:
|
||||
config_method_ttls &m_cfg; ///< Method configuration
|
||||
credentials_tls_tunnel &m_cred; ///< Method user credentials
|
||||
config_method_tls_tunnel &m_cfg; ///< Method configuration
|
||||
credentials_tls_tunnel &m_cred; ///< Method user credentials
|
||||
HANDLE m_user_ctx; ///< Handle to user context
|
||||
winstd::tstring m_sc_target_name; ///< Schannel target name
|
||||
winstd::sec_credentials m_sc_cred; ///< Schannel client credentials
|
||||
|
Reference in New Issue
Block a user