eap::credentials::get_name() method introduced to allow more detailed display of certificate names
This commit is contained in:
parent
4f6943044f
commit
a92cafea36
@ -239,6 +239,11 @@ namespace eap
|
|||||||
///
|
///
|
||||||
virtual std::wstring get_identity() const = 0;
|
virtual std::wstring get_identity() const = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns credential name (for GUI display).
|
||||||
|
///
|
||||||
|
virtual winstd::tstring get_name() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// \name Storage
|
/// \name Storage
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -96,6 +96,12 @@ bool eap::credentials::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tstring eap::credentials::get_name() const
|
||||||
|
{
|
||||||
|
return get_identity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// eap::credentials_pass
|
// eap::credentials_pass
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -432,7 +432,7 @@ protected:
|
|||||||
m_own_clear ->Enable(false);
|
m_own_clear ->Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_preshared_identity->SetValue(!m_cred.empty() ? m_cred.get_identity() : _("<blank>"));
|
m_preshared_identity->SetValue(!m_cred.empty() ? m_cred.get_name() : _("<blank>"));
|
||||||
|
|
||||||
if (!m_prov.m_read_only) {
|
if (!m_prov.m_read_only) {
|
||||||
// This is not a provider-locked configuration. Selectively enable/disable controls.
|
// This is not a provider-locked configuration. Selectively enable/disable controls.
|
||||||
|
@ -192,6 +192,11 @@ namespace eap
|
|||||||
///
|
///
|
||||||
virtual std::wstring get_identity() const;
|
virtual std::wstring get_identity() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns credential name (for GUI display).
|
||||||
|
///
|
||||||
|
virtual winstd::tstring get_name() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// \name Storage
|
/// \name Storage
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -156,7 +156,7 @@ bool eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR *
|
|||||||
m_cert.create(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, aData.data(), (DWORD)aData.size());
|
m_cert.create(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, aData.data(), (DWORD)aData.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_module.log_config((xpath + L"/ClientCertificate").c_str(), m_cert ? eap::get_cert_title(m_cert).c_str() : L"<blank>");
|
m_module.log_config((xpath + L"/ClientCertificate").c_str(), get_name().c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -177,11 +177,11 @@ bool eap::credentials_tls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **p
|
|||||||
}
|
}
|
||||||
|
|
||||||
tstring target(target_name(pszTargetName));
|
tstring target(target_name(pszTargetName));
|
||||||
wstring identity(std::move(get_identity()));
|
wstring name(std::move(get_name()));
|
||||||
|
|
||||||
// Write credentials.
|
// Write credentials.
|
||||||
assert(cred_enc.cbData < CRED_MAX_CREDENTIAL_BLOB_SIZE);
|
assert(cred_enc.cbData < CRED_MAX_CREDENTIAL_BLOB_SIZE);
|
||||||
assert(identity.length() < CRED_MAX_USERNAME_LENGTH );
|
assert(name.length() < CRED_MAX_USERNAME_LENGTH );
|
||||||
CREDENTIAL cred = {
|
CREDENTIAL cred = {
|
||||||
0, // Flags
|
0, // Flags
|
||||||
CRED_TYPE_GENERIC, // Type
|
CRED_TYPE_GENERIC, // Type
|
||||||
@ -194,7 +194,7 @@ bool eap::credentials_tls::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **p
|
|||||||
0, // AttributeCount
|
0, // AttributeCount
|
||||||
NULL, // Attributes
|
NULL, // Attributes
|
||||||
NULL, // TargetAlias
|
NULL, // TargetAlias
|
||||||
(LPTSTR)identity.c_str() // UserName
|
(LPTSTR)name.c_str() // UserName
|
||||||
};
|
};
|
||||||
if (!CredWrite(&cred, 0)) {
|
if (!CredWrite(&cred, 0)) {
|
||||||
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed."));
|
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed."));
|
||||||
@ -232,7 +232,7 @@ bool eap::credentials_tls::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_module.log_config((wstring(pszTargetName) + L"/Certificate").c_str(), m_cert ? eap::get_cert_title(m_cert).c_str() : L"<blank>");
|
m_module.log_config((wstring(pszTargetName) + L"/Certificate").c_str(), get_name().c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -250,6 +250,13 @@ std::wstring eap::credentials_tls::get_identity() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tstring eap::credentials_tls::get_name() const
|
||||||
|
{
|
||||||
|
return m_cert ? std::move(eap::get_cert_title(m_cert)) : L"<blank>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LPCTSTR eap::credentials_tls::target_suffix() const
|
LPCTSTR eap::credentials_tls::target_suffix() const
|
||||||
{
|
{
|
||||||
return _T("TLS");
|
return _T("TLS");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user