登录方式使用GINA定制

发布于 2024-07-13 11:52:40 字数 619 浏览 8 评论 0原文

我知道在 GINA 中找到大师并不容易,但我的问题最接近进程间通信(IPC),我用非托管 c++ 编写了自定义 GINA,我在其中包含了一个方法来检查用户尝试的指纹的有效性登录时,此函数将调用用 c# 编写的正在运行的系统 windows 服务中的一些方法,代码如下:

在 GINA 中,

if(Fingerprint.Validate(userName,finerprintTemplate)
{
    //perform login
}

windows 服务中的非托管 c++,C#

public class Fingerprint
{
   public static bool Validate(string userName, byte[] finerprintTemplate)
   {
      //Preform Some code to validate fingerprintTemplate with userName
      //and retuen result
   }
}

有谁知道如何在 GINA 和 windows 服务之间进行这样的通信,或者简单地介于 C++ 编写的服务和 C# 编写的服务之间。

谢谢

I know it's not easy to find a master in GINA, but my question is most near to Interprocess Communication(IPC), I wrote my custom GINA in unmanaged c++, I included it a method that checks for validity of a fingerprint for the user try to login, this function will call some method in a running system windows service written in c#, the code follows:

in GINA, unmanaged c++

if(Fingerprint.Validate(userName,finerprintTemplate)
{
    //perform login
}

in windows service, C#

public class Fingerprint
{
   public static bool Validate(string userName, byte[] finerprintTemplate)
   {
      //Preform Some code to validate fingerprintTemplate with userName
      //and retuen result
   }
}

Does anyone know how to do such Communication between GINA and the windows service, or simply between c++ written service and C# written service.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

微暖i 2024-07-20 11:52:41

NISGINA 是一个用于身份验证的开源 GINA 插件针对 NIS 目录。 如果您还没有看过这个,这是我所知道的唯一一个开源 GINA 插件示例。 如果您还没有这样做,您可能会发现值得花时间仔细阅读源代码。

请注意,从 Windows Vista 开始,GINA 已被弃用并且替换为另一个名为凭据提供程序体系结构的 API。

NISGINA is an open-source GINA plugin to authenticate against a NIS directory. If you haven't already seen this, it's the only example of an open-source GINA plugin that I'm aware of. If you haven't already, You might find it worth your while to peruse the source code for this.

Note that as of Windows Vista, GINA has been deprecated and replaced with another API called Credential Provider Architecture.

酷到爆炸 2024-07-20 11:52:41

我强烈建议您使用命名管道。 如果您使用的是 .Net 3.5 或更高版本,它们在 C# 方面速度快且易于使用,并且在 C++ 方面相对容易使用(有大量可用示例)。 最重要的是,通过应用简单的安全描述符,非常容易确保安全。

I'd strongly recommend that you use named pipes. They are fast, easy to use from the C# side, provided you are using .Net 3.5 or higher, and relatively easy from the C++ side (with lots of examples available). And most importantly very easy to secure by applying a simple security descriptor.

指尖上得阳光 2024-07-20 11:52:41

我很好奇您是否遵循建议的“答案”并尝试了命名管道路线? 根据此链接和我自己的经验,GINA 的运作方式是预验证(会话 0)上下文以及任何从非托管 C++ GINA dll 访问命名管道的尝试都将导致错误 #5“访问被拒绝”。

我相信 Mailslots 可能是唯一可用的 Windows IPC 机制,在该级别实际上可用,但我什至不确定它是否会起作用(还没有尝试过。)

I'm curious if you followed the suggested "answers" and attempted the Named Pipe route? According to both this link and my own experience, GINA operates in a pre-authenticated (Session 0) context and any attempt to access a Named Pipe from your unmanaged C++ GINA dll will result in Error #5 "access is denied".

I believe Mailslots may be the only available Windows IPC mechanism that is actually available at that level, but I'm not even certain that will work (haven't tried.)

感悟人生的甜 2024-07-20 11:52:40

与服务(或大多数可能需要跨越会话/桌面边界的 IPC)通信的规范方法是命名管道。 您也可以使用邮槽,但您必须处理重复问题,因为邮槽消息在所有已安装的协议中都会被欺骗,因此您需要某种标记系统......变得有点混乱。

请参阅 CreateNamedPipe 的文档并从那里开始工作。 我已经使用管道在 C++ 和 C# 之间进行了讨论:互操作有点混乱(二进制消息),但它是可行的。 有一些 C# 管道的示例代码(来自双方) 在这里

使用管道解决特定服务到服务通信问题的好处是,如果需要,您可以稍后扩展设计以支持 UI。

The canonical method for communicating with a service (or most IPC that potentially needs to cross a session/desktop boundary) is a named pipe. You can use mailslots as well, but you have to deal with duplication issues because mailslot messages get duped across all installed protocols, so you need some kind of tagging system... gets kinda messy.

See the docs for CreateNamedPipe and work your way out from there. I have talked between C++ and C# using pipes: the interop got a little messy (binary messages), but its do-able. There's some sample code for C# pipes (from both sides) here.

The nice thing about using a pipe for your specific service to service comms problem is you can expand the design later on to support a UI if you need it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文