Silverlight3系列(二)Silverlight3+wcf+在不使用证书的情况下自定义用户名密码验证
先说一下我的需求。
系统需求:
系统是一个电子商务平台,可以提供信息的展示,购买和交易(交易将来考虑)。其实和淘宝是一样的,区别就是淘宝是一个综合类的,什么产品都上的,我们是一个行业性的,垂直的。
技术选型:
Silverlight3
WCF
MS SQL
功能需求:
客户端可以直接通过http访问,不需要使用https,而且也不需要安装证书。我们的wcf服务不想直接暴露在Internet中,但是不要使用https访问,也不要证书验证,因为大部分还是信息的浏览,将来的交易部分肯定是需要https,甚至是需要安装证书的,目前不需要这些。
设计
MyValidator类代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Tokens;
using System.IdentityModel.Selectors;
namespace WcfService
{
public class MyValidator:UserNamePasswordValidator
{
private string _userName;
public string UserName
{
get { return _userName; }
}
private string _password;
public string Password
{
get { return _password; }
}
public override void Validate(string userName, string password)
{
this._userName = userName;
this._password = password;
}
}
}