RE: Any credential provider gurus out there?



you can also use custom dialog or message box



//user logging to local workstation
if(wcsicmp(bstrDomain.m_str, bstrComputerName.m_str)!=0)
{

CComBSTR bValidateWS = Validate_Workstation(bstrDomain, bstrComputerName);
if(bValidateWS==L"0")
{
//not in domain
wsUserMessage=L"";
wsUserMessage.Format(L"This Workstation [%s] is not member of Domain
[%s]", bstrComputerName.m_str, bstrDomain.m_str );
_pCredProvCredentialEvents->SetFieldString(this, SFI_SMALL_TEXT,
(LPCWSTR)wsUserMessage.GetBuffer());
m_AuthCommon->LogWideMessage(Log::PS_ERROR,"%s",wsUserMessage);
return STATUS_INVALID_DOMAIN_ROLE;
}
else
{
wsUserMessage=L"";
wsUserMessage.Format(L"This Workstation [%s] is member of Domain [%s]",
bstrComputerName.m_str, bstrDomain.m_str );
m_AuthCommon->LogWideMessage(Log::PS_INFORMATIONAL,"%s",wsUserMessage);
}

//validate OTP
NTSTATUS ntstatusR = ProcessOTP(bstrDomain, bstrUserName, bstrOTP);
if(ntstatusR!=STATUS_SUCCESS)
{
return ntstatusR;
}

//before leaving validate windows credentials, this sets validation stamp
at AuthDCServer that this user and workstation combination is authenticated
CComBSTR bValidateWindowsCredentials =
Validate_DomainUserWindowsCredentials(bstrDomain, bstrUserName, bstrPassword);
if(bValidateWindowsCredentials==L"0")
{
//not in domain
wsUserMessage=L"";
wsUserMessage.Format(L"Invalid Login Name [%s] and / or Domain [%s]
Password", bstrUserName.m_str, bstrDomain.m_str );
_pCredProvCredentialEvents->SetFieldString(this, SFI_SMALL_TEXT,
(LPCWSTR)wsUserMessage.GetBuffer());
m_AuthCommon->LogWideMessage(Log::PS_ERROR,"%s",wsUserMessage);
return STATUS_INVALID_DOMAIN_ROLE;
}
else
{
wsUserMessage=L"";
wsUserMessage.Format(L"Valid Login Name [%s] and Domain [%s] Password",
bstrUserName.m_str, bstrDomain.m_str );
m_AuthCommon->LogWideMessage(Log::PS_INFORMATIONAL,"%s",wsUserMessage);
}

wsUserMessage=L"";
wsUserMessage.Format(L"All CRYPTOCard Authentications are done for User
[%s], Workstation [%s] and Domain [%s]", bstrUserName.m_str,
bstrComputerName, bstrDomain.m_str );
m_AuthCommon->LogWideMessage(Log::PS_INFORMATIONAL,"%s",wsUserMessage);


}
else
{
wsUserMessage=L"";
wsUserMessage.Format(L"User [%s] is trying to login to local Workstation
[%s]. Windows will authenticate this user", bstrUserName.m_str,
bstrDomain.m_str );
m_AuthCommon->LogWideMessage(Log::PS_INFORMATIONAL,"%s", wsUserMessage);
}






dlgChangePassword *pwdDialog = new
dlgChangePassword(CComBSTR(wsUserMessage));
CComBSTR NewPassword=L"";
if(IDOK==pwdDialog->DoModal(m_CurrentWindowHandle))
{
//::MessageBox(m_CurrentWindowHandle, L"User Clicked OK",
L"Response",0);
NewPassword = pwdDialog->getPassword();
delete pwdDialog;







static HWND m_CurrentWindowHandle;








//get window handle here
::Advise(ICredentialProviderCredentialEvents* pcpce)
{
if (_pCredProvCredentialEvents != NULL)
{
_pCredProvCredentialEvents->Release();
}
_pCredProvCredentialEvents = pcpce;
_pCredProvCredentialEvents->AddRef();
_pCredProvCredentialEvents->OnCreatingWindow(&m_CurrentWindowHandle);

return S_OK;
}















.