locked
Credential Provider Filter RRS feed

  • Question

  • Had success implementing my Credential Provider based on samples from msdn.
    Now want to disable others, how to?
    I saw i need a credential provider filter so i added a new class in my provider and implemented the ICredentialProviderFilter interface, added the registry keys and come to this:

    MyFilter::MyFilter(void)
    {
    }

    MyFilter::~MyFilter(void)
    {
    }


    HRESULT MyFilter::Filter(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus,DWORD dwFlags,GUID* rgclsidProviders,BOOL* rgbAllow,DWORD cProviders)
    {
        MessageBox(NULL, "Filter!", "Trace", NULL);
        switch (cpus)
        {
            case CPUS_LOGON:
            case CPUS_UNLOCK_WORKSTATION:
                //Filters out the default Windows provider (only for Logon and Unlock scenarios)
                for (int i = 0; i < cProviders; i++)
                {
                    if (IsEqualGUID(rgclsidProvidersIdea, CLSID_SmartcardCredentialProvider))
                    rgbAllowIdea = FALSE;
                }
            return S_OK;
            case CPUS_CREDUI:
            case CPUS_CHANGE_PASSWORD:
            return E_NOTIMPL;
            default:
            return E_INVALIDARG;
        }
    }

    HRESULT MyFilter::UpdateRemoteCredential(const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcsIn, CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcsOut)

    {
        return E_NOTIMPL;
    }

    ...

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{75A22DF0-B81D-46ed-B119-CD30507BD615}]
    @="CredentialProvider"

    ...  i'm really new to COM programming, can someone point a direction?
    Thanks


    Tuesday, February 26, 2008 4:06 PM

All replies

  • I recently ran into the same problem:

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2775055&SiteID=1

     

    It looks like all you are missing is the COM boilerplate stuff. You can use the stuff from the Credential Provider class you have as a template. You'll need to copy over that STDMETHOD stuff from the header file, modify the interface in QueryInterface to be "IID_ICredentialProviderFilter," create your own version of the CSampleProvider_CreateInstance method, and update the CreateInstance method in dll.cpp to work for your filter class as well. I think that's everything. Smile

     

    I'm in a hurry now, but I can post some code later if you need it.

     

     

    Tuesday, February 26, 2008 4:52 PM
  • Thanks a lot, if you can post some code i'll be really thankful!
    Anyway thanks a lot for the hints.

    Wednesday, February 27, 2008 8:40 AM
  • Cool, it works now!
    Thanks a lot

    Wednesday, February 27, 2008 1:53 PM
  • Hi

    Can you post the code you used for the filter?

    Thnx
    Sunday, July 19, 2009 7:57 AM
  • Can you post your code. I am trying to implement a filter, but can't get it to work.....

    thanks

    zak
    Tuesday, January 19, 2010 10:31 PM
  • Can anyone have working Windows 8 credential provider filter sample code ?

    If you have, please send me.


    Wednesday, June 24, 2015 6:44 PM