简体   繁体   English

Windows 10 凭据提供者 C#

[英]Windows 10 Credential Provider with C#

I am working on implementing a Credential Provider in C#.我正在努力在 C# 中实施凭证提供程序。

I have downloaded the V2 Credential Provider sample in C++, which is for Windows 8, and managed to make it work on my Windows 10 PC.我已经在 C++ 下载了 V2 Credential Provider 示例,它适用于 Windows 8,并设法使其在我的 Windows 10 PC 上运行。 I also looked into this credential provider implementation in .NET https://github.com/SteveSyfuhs/CredProvider.NET , but this is for the CredUI scenario.我还在 .NET https://github.com/SteveSyfuhs/CredProvider.NET中查看了这个凭证提供程序实现,但这是针对 CredUI 场景的。

I have managed to make my credential provider to be displayed under "Sign-in options" of a user's tile, but now I would like to implement the login part.我已经设法让我的凭据提供者显示在用户磁贴的“登录选项”下,但现在我想实现登录部分。

I have to implement the GetSerialization method for the Logon/Unlock scenario.我必须为登录/解锁方案实施 GetSerialization 方法。 In the C++ sample this is already implemented, but I have troubles "translating" it into C# code, since I am not familiar with C++.在 C++ 示例中,这已经实现,但我很难将其“翻译”成 C# 代码,因为我不熟悉 C++。

Does anyone know where I could find a working implementation of this method in C# for the Logon/Unlock scenario?有谁知道在 C# 中我可以在哪里找到针对登录/解锁场景的此方法的有效实现? Any help would be very appreciated.任何帮助将不胜感激。

I see that you're familiar only with C# and you want to use that only for the CP you're working on. 我看到你只熟悉C#,并且你只想将它用于你正在使用的CP。
I have worked on CP with c++ though I would have preferred to use C# too which am more agile with. 我已经使用c ++开发了CP,虽然我更喜欢使用C#,这样更灵活。

Implementing the Lock/Unlock isn't fully implemented in the C++ sample as you expressed. 正如您所表达的那样,在C ++示例中没有完全实现锁定/解锁。 You have to intercept the code in the right place to add additional rules/ features in your project. 您必须在正确的位置拦截代码以在项目中添加其他规则/功能。 Anyway, you can paste some codes and let's look into it together. 无论如何,你可以粘贴一些代码,让我们一起看看。

You have to write KerbInteractiveUnlockLogonInit and KerbInteractiveUnlockLogonPack methods in C++ and use it with DllImport from your C# project.您必须在 C++ 中编写 KerbInteractiveUnlockLogonInit 和 KerbInteractiveUnlockLogonPack 方法,并将其与 C# 项目中的 DllImport 一起使用。 According to CREDENTIAL_PROVIDER_USAGE_SCENARIO, you need to set MessageType property of KERB_INTERACTIVE_LOGON struct.根据 CREDENTIAL_PROVIDER_USAGE_SCENARIO,您需要设置 KERB_INTERACTIVE_LOGON 结构的 MessageType 属性。 You can get methods from here .您可以从这里获取方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM