美文网首页Coding
Windows自定义登录认证开发-C#

Windows自定义登录认证开发-C#

作者: 清水包哟 | 来源:发表于2018-10-24 18:43 被阅读14次

    在官网找到个C++ Demo,通过查看源码得知需要自己编写一个 credential provider的C++类,继承于ICredentialProvider (credentialprovider.h) 这个接口。

    stack overflow上有个哥们儿这么说道:

    The new CredentialProvider model in Windows Vista and higher is based on COM. This means that it should be possible as long as you implement the correct COM interfaces.

    Based on this, it should be easier to build than the older GINA model since the older GINA module used DLL entry points and function pointers instead of COM interfaces.

    Given the ability for .Net to inter-operate with COM, it should be as easy as:

    1. Building a C# definition of the ICredentialProvider interface and adding the correct COM attributes with the correct GUIDS

    2. Building a credential provider class that implements the ICredenitalProvider and is marked as COMVisible(True)

    3. Registering the new assembly with Regasm

    4. Adding the correct registry keys to register your new CredentialProvider with Windows (Software\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers)

    If you do all of that, you will have a working credential provider, written in C#

    他的意思大概就是Vista以后的ICredentialProvider接口都是基础COM来实现的,C#处理起来COM很容易,直接在C#里面声明这个接口再实现它吧,你将会很简单的完成这个东东。

    然而有更多的人直接推荐了pgina 这个三方库,它主要是就是做自定义的windows凭据校验。如果你不需要太多的验证,高度的自定义,你可以写一个它的插件(托管代码)来实现你自己的东东。

    相关文章

      网友评论

        本文标题:Windows自定义登录认证开发-C#

        本文链接:https://www.haomeiwen.com/subject/xdextqtx.html