使用 basicHttpBinding 和自定义 UserNamePasswordValidator 的 WCF 身份验证 [英] WCF Authentication using basicHttpBinding and custom UserNamePasswordValidator

查看:24
本文介绍了使用 basicHttpBinding 和自定义 UserNamePasswordValidator 的 WCF 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个问题是,是否可以将自定义 UserNamePasswordValidor 与 basicHttpBinding 一起使用?

My first question is, is it even possible to use a custom UserNamePasswordValidor with basicHttpBinding?

我有一个使用表单身份验证和自定义成员资格提供程序的 asp.net 网站.我意识到我可以使用内置的 System.Web.ApplicationServices.AuthenticationService 来验证我的客户端(一个 WPF 应用程序),但我不想要两个服务调用(一个用于身份验证服务,一个用于逻辑).

I have a asp.net web site using Forms authentication and a custom membership provider. I realise that I could use the built in System.Web.ApplicationServices.AuthenticationService to authenticate my client (a WPF app) but I don't want two service calls (one for auth service, one for logic).

因此,自定义 UserNamePasswordValidator 似乎非常适合这项工作.在我的客户中,我可以有:

So it seems that a custom UserNamePasswordValidator would be perfect for the job. In my client I can then have:

        var service = new MyServiceClient();
        service.ClientCredentials.UserName.UserName = "username";
        service.ClientCredentials.UserName.Password = "password";

        MessageBox.Show(service.SayHello());

我已经看到这与 wsHttpBinding 一起工作,但理想情况下想在没有 SSL 证书的情况下进行测试.

I've seen this working with wsHttpBinding but ideally would like to test without an SSL certificate.

或者,是否可以从另一个 WCF 服务中使用 AuthenticationService?

Alternatively, is it possible to make use of the AuthenticationService from within another WCF service?

为了澄清我上面关于身份验证服务的意思,我不想有 2 个服务调用,即:

To clarify what I mean above regarding authentication service, I don't want to have 2 service calls i.e:

            if (authService.Login("username", "password"))
            // then call my service

我知道这是一件小事,但客户端应用程序的外部开发人员只需要一项获取凭据并返回所需数据的服务.

I know this a minor thing but the external developer of the client app is expecting just one service that takes the credentials and returns the required data.

谢谢,本

推荐答案

检查 ClearUserName 绑定:http://webservices20.blogspot.com/2008/11/introducing-wcf-clearusernamebinding.html 它应该可以解决您的问题.

check ClearUserName binding: http://webservices20.blogspot.com/2008/11/introducing-wcf-clearusernamebinding.html It should solve your problem.

这篇关于使用 basicHttpBinding 和自定义 UserNamePasswordValidator 的 WCF 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆