wcf 访问控制
public class PasswordDigestChannelFactory<TPortTypeClient, TPlugin>
where TPortTypeClient : ClientBase<TPlugin>, TPlugin, new()
where TPlugin : class
{
public PasswordDigestChannelFactory(string endpointConfigurationName)
{
_endpointConfigurationName = endpointConfigurationName;
} private readonly string _endpointConfigurationName; public TPlugin GetClient()
{
var args = new[] {_endpointConfigurationName};
var portInstance = Activator.CreateInstance(typeof (TPortTypeClient), args) as ClientBase<TPlugin>; // replace ClientCredentials with UsernameClientCredentials
var username = "username";
var password = "password"; var credentials = new UsernameClientCredentials(new UsernameInfo(username, password));
portInstance.ChannelFactory.Endpoint.Behaviors.Remove(typeof (ClientCredentials));
portInstance.ChannelFactory.Endpoint.Behaviors.Add(credentials); return portInstance as TPlugin;
}
} // StructureMap injection
For<PortType>()
.Use((new PasswordDigestChannelFactory<PortTypeClient, PortType>("endPoint")).GetClient());
wcf 访问控制的更多相关文章
- WCF学习第二篇:WCF 配置架构。这有助于对wcf配置的理解和记忆
使用 Windows Communication Foundation (WCF) 配置元素,您可以配置 WCF 服务和客户端应用程序. 可以使用配置编辑器工具 (SvcConfigEditor.ex ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- WCF
--http://www.doc88.com/p-699300196010.html ---术语 WCF术语 消息(message) 消息是一个独立的数据单元,它可能由几个部分组成,包括消息正文和消息 ...
- WCF、Net remoting、Web service概念及区别
Windows通信基础(Windows Communication Foundation,WCF)是基于Windows平台下开发和部署服务的软件开发包(Software Development Kit ...
- 从开发的角度比较 ASP.NET Web 服务与 WCF
Windows Communication Foundation (WCF) 具有一个 ASP.NET 兼容模式选项,用户使用此选项可以对 WCF 应用程序进行编程和配置,使其像 ASP.NET We ...
- [转]WCF 4 安全性和 WIF 简介
转自:http://www.cnblogs.com/WizardWu/archive/2010/10/04/1841793.html 本帖简介 .NET 新一代的 Windows Identity ...
- WCF学习笔记(一):WCF简介
转:http://www.cnblogs.com/wengyuli/archive/2009/11/04/1595693.html MSDN上关于WCF给出如下注解: 设计 Windows Commu ...
- WCF、.Net Remoting、Web Service概念及区别
此文章主要参考http://www.cnblogs.com/weiweibtm/archive/2013/06/21/3148583.html 参考书籍<WCF全面解析上册>.<WC ...
- (WCF初体验)WCF的认证和消息保护
最近做WCF开发,有个需求是在服务端做认证,网上查资料了解到可以用UserName和Password 来做认证,只需要写好配置文件和在服务端写好验证类就行了,但是网上普遍的博文都是需要用证书,而我自己 ...
随机推荐
- Vector bit-select and part-select addressing verilog片选写法
大端 m m[ a +: b ] == m[ (a+b-1) : a ] m[ a -: b ] == m[ a : (a-b+1) ] 小端 n n[ a +: b ] == n[ a : (a+b ...
- [JAVA]Apache FTPClient操作“卡死”问题的分析和解决
最近在和一个第三方的合作中不得已需要使用FTP文件接口.由于FTP Server由对方提供,而且双方背后各自的网络环境都很不单纯等等原因,造成测试环境无法模拟实际情况.测试环境中程序一切正常,但是在部 ...
- Ubuntu下配置安装Hadoop 2.2
---恢复内容开始--- 这两天玩Hadoop,之前在我的Mac上配置了好长时间都没成功的Hadoop环境,今天想在win7 虚拟机下的Ubuntu12.04 64位机下配置, 然后再建一个组群看一看 ...
- mysql_connect(): Headers and client library minor version mismatch.
查询当前Client 版本,结果如下: Client API version => 5.6.31Client API library version => 5.6.31Client API ...
- eclipse中点不出方法的解决办法
window-preferences-java-editor-Content Assist-Advanced 然后选中右上方的所有 右下方选中一个即可.
- ServletRequestLister
1 知识点
- Iterator和for...of循环
Iterator和for...of循环 Iterator(遍历器)的概念 数据结构的默认Iterator接口 调用Iterator接口的场合 字符串的Iterator接口 Iterator接口与Gen ...
- php中cookie的操作
php设置和获取cookie 创建cookie setcookie('mycookie','value',time()+86400);//参数3 cookie过期时间//函数原型:int setcoo ...
- 本地如何将svn和git管理的代码做关联
svn和git都是广为流传的代码版本管理工具,实际项目中往往会将两者结合使用,那么如何将本地的一份代码和两者做有机的关联呢! 前提假设:项目已经在开发阶段中,此时变更了svn代码库的地址:或者是组里来 ...
- Go.基础篇-1
package main import "fmt" import "math" import "errors" func main(){ f ...