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 来做认证,只需要写好配置文件和在服务端写好验证类就行了,但是网上普遍的博文都是需要用证书,而我自己 ...
随机推荐
- 使用virtualbox虚拟安装macos
需要工具: 虚拟机virtualbox:https://www.virtualbox.org/ empireEFIv1085.iso启动文件:http://yunpan.cn/c6UDGwL6wJm6 ...
- SQLite3开发接口函数详解
SQLite3是SQLite一个全新的版本,它虽然是在SQLite 2.8.13的代码基础之上开发的,但是使用了和之前的版本不兼容的数据库格式和API. SQLite3是为了满足以下的需求而开发的: ...
- 2016424王启元 Exp3免杀原理与实现
基础问题回答 1.杀软是如何检测出恶意代码的? (1)基于特征码的检测 特征码是能识别一个程序是一个病毒的一段不大于64字节的特征串.如果一个可执行文件包含这样的特征码则被杀毒软件检测为是恶意代码. ...
- FormsAuthentication实现登录(转)
配置项描述: <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl=& ...
- Fiddler使用一(Fiddler简介)
参考文章:http://blog.csdn.net/ohmygirl/article/details/17846199 1.为什么是Fiddler? 抓包工具有很多,小到最常用的web调试工具fire ...
- Signal Handling--ref
http://www.chemie.fu-berlin.de/chemnet/use/info/libc/libc_21.html A signal is a software interrupt d ...
- 公司管理系列--80% of Your Culture is Your Founder(FaceBook)
80% of Your Culture is Your Founder When Molly Graham joined Facebook in 2008, the company still ...
- AngularJS的日期格式化有两种形式
AngularJS的日期格式化有两种形式,一种是在HTML页面,一种是在JS代码里,都是用到AngularJS的过滤器$filter. HTML: date_expression 即 你在$scope ...
- centos6.x硬件信息统计脚本
#!/bin/bash Line='===========' #linux发行版名称 if [[ -f /usr/bin/lsb_release ]]; then OS=$(/usr/bin/lsb_ ...
- Hadoop实战之一~Hadoop概述
对技术,我还是抱有敬畏之心的. Hadoop概述 Hadoop是一个开源分布式云计算平台,基于Map/Reduce模型的,处理海量数据的离线分析工具.基于Java开发,建立在HDFS上,最早由Goog ...