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 来做认证,只需要写好配置文件和在服务端写好验证类就行了,但是网上普遍的博文都是需要用证书,而我自己 ...
随机推荐
- google +ubuntu16.04
1.在终端中输入以下命令 sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.list.d/ 2 ...
- how to install mapr sandbox
Sometimes we need a standalone envrionment to test Hadoop and Spark, mapr is a choice to do that in ...
- 【Lua】遍历目录结果输出到页面中,刷新页面后出现500 Internal Server Error
在通过lua获取目录json字符串,然后作为数据源,通过Extjs生成树的过程中,发生了一个奇怪的问题,那就是获取目录json字符串然后传递给Extjs生成树的这个过程中,一开始都是很顺利的就生成了, ...
- Java TCP/IP与HTTP协议个人总结(原创)
首先举个例子方便理解: 1.应用层(http.ftp)就类似:淘宝.京东.易购等网购网站,主要用来负责选择购买商品(制定协议). 2.传输层(TCP.UDP)就类似:中通.申通等物流公司,主要负责传送 ...
- unity下载资源存储-生成md5
IEnumerator GetText() { using (UnityWebRequest request = UnityWebRequest.Get("localhost:80/txt/ ...
- ELF文件解析器支持x86x64ELF文件
此文为静态分析ELF文件结构,遍历其中Elf_Ehdr文件头信息,遍历Elf_Shdr节表头信息,并将所有节放置在左侧树控件上,遍历Elf_Phdr程序头也放置在左侧树控件上,并着重分析字符串表,重定 ...
- Oracle 架构
- 【JSON.parse()和JSON.stringify()】
var str = '{"name":"huangxiaojian","age":"23"}' 结果: JSON.par ...
- Expression Blend实例中文教程(10) - 缓冲动画快速入门Easing
随着Rich Internet application(RIA)应用技术的发展,各个公司越来越注重于项目的用户体验性,在保证其功能完善,运行稳定的基础上,绚丽的UI和人性化的操作设计会给用户带来舒适的 ...
- CSS 文字超长省略显示并隐藏超长部分
1.包含文字的元素必须是块级元素,不是块级元素使用display:block使其具有块级元素属性: 2.具备上述基本条件后,css样式如下: { display: block; max-width: ...