How to: Use a Custom User Name and Password Validator(WCF)
在wcf中使用自定义的用户名和密码验证方式
https://msdn.microsoft.com/en-us/library/aa702565.aspx
http://www.codeproject.com/Articles/96028/WCF-Service-with-custom-username-password-authenti
To configure a service to use a custom user name and password validator
Configure a binding that uses message security over any transport or transport-level security over HTTP(S).
When using message security, add one of the system-provided bindings, such as a <wsHttpBinding>, or a <customBinding> that supports message security and the UserName credential type.
When using transport-level security over HTTP(S), add either the <wsHttpBinding> or <basicHttpBinding>, a <netTcpBinding> or a <customBinding> that uses HTTP(S) and the Basic authentication scheme.
NoteWhen .NET Framework version 3.5 or later is used, you can use a custom username and password validator with message and transport security. With WinFX, a custom username and password validator can only be used with message security.
TipFor more information on using <netTcpBinding> in this context, see <security> of <netTcpBinding>
In the configuration file, under the <system.serviceModel> element, add a <bindings> element.
Add a <wsHttpBinding> or <basicHttpBinding> element to the bindings section. For more information about creating an WCF binding element, see How to: Specify a Service Binding in Configuration.
Set the mode attribute of the <security> of <wsHttpBinding> or <security> of <basicHttpBinding> to Message, Transport, or TransportWithMessageCredential.
Set the clientCredentialType attribute of the <message> of <wsHttpBinding> or <transport> of <wsHttpBinding>.
如果第3步使用的是Security是Message,那么就设置MessageSecurity的MessageClientCredentialType为UserName
When using message security, set the clientCredentialType attribute of the <message> of <wsHttpBinding> to UserName.
When using transport-level security over HTTP(S), set the clientCredentialType attribute of the <transport> of <wsHttpBinding> or <transport> of <basicHttpBinding> to Basic.
Note |
|---|
|
When a WCF service is hosted in Internet Information Services (IIS) using transport-level security and the UserNamePasswordValidationMode property is set to Custom, the custom authentication scheme uses a subset of Windows authentication. That is because in this scenario, IIS performs Windows authentication prior to WCF invoking the custom authenticator. |
For more information about creating an WCF binding element, see How to: Specify a Service Binding in Configuration.
The following example shows the configuration code for the binding.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
netTcpBinding的security的Mode属性,可以设置为4种类型,选择Message


2.Configure a behavior that specifies that a custom user name and password validator is used to validate user name and password pairs for incoming UserNameSecurityToken security tokens.
As a child to the <system.serviceModel> element, add a <behaviors> element.
Add a <serviceBehaviors> to the <behaviors> element.
Add a <behavior> of <serviceBehaviors> element and set the name attribute to an appropriate value.
Add a <serviceCredentials> to the <behavior> of <serviceBehaviors> element.
Add a <userNameAuthentication> to the <serviceCredentials>.
Set the userNamePasswordValidationMode to Custom.
ImportantIf the userNamePasswordValidationMode value is not set, WCF uses Windows authentication instead of the custom user name and password validator.
Set the customUserNamePasswordValidatorType to the type that represents your custom user name and password validator.
The following example shows the <serviceCredentials> fragment to this point.
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Microsoft.ServiceModel.Samples.CalculatorService.CustomUserNameValidator, service" />
</serviceCredentials>
How to: Use a Custom User Name and Password Validator(WCF)的更多相关文章
- How to: Use a Custom User Name and Password Validator
在wcf中使用自定义的用户名和密码验证方式 https://msdn.microsoft.com/en-us/library/aa702565.aspx http://www.codeproject. ...
- 【ASP.NET Identity系列教程(一)】ASP.NET Identity入门
注:本文是[ASP.NET Identity系列教程]的第一篇.本系列教程详细.完整.深入地介绍了微软的ASP.NET Identity技术,描述了如何运用ASP.NET Identity实现应用程序 ...
- P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1
P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1 May ...
- 优秀的PHP开源项目集合
包管理Package Management Package Management Related 框架 框架组件 微框架Micro Frameworks 内容管理系统Content Managemen ...
- SSL构建单双向https认证
1. SSL基本介绍 我们常常在使用网上银行时看到的连接都是以“https”开始的,那么这个https是什么呢?这其实是表示目前连接使用了SSL进加密,能保证客户端到服务器端的通信都在被保护起来,那 ...
- PHP框架、库和软件资源大全(整理篇)
php的资料 https://github.com/ziadoz/awesome-php Awesome PHP A curated list of amazingly awesome PHP lib ...
- Bootstrap风格登录界面设计样例
参考:http://bootsnipp.com/tags/login Register Page 127.8K 187 Modal Login with jQuery Effects 159. ...
- ios swift模仿qq登陆界面,xml布局
给大家推荐两个学习的地址: 极客学院的视频:http://www.jikexueyuan.com/path/ios/ 一个博客:http://blog.csdn.net/lizhongfu2013/a ...
- FNDCPASS Troubleshooting Guide For Login and Changing Applications Passwords
In this Document Goal Solution 1. Error Starting Application Services After Changing APPS Pass ...
随机推荐
- Mac005--VS&webstorm前端开发工具安装
Mac--Visual studio Code工具安装(企业常用) 安装网址:https://code.visualstudio.com/download 设置格式: 1.配置工作区与终端字体大小 常 ...
- pgsql删除重复记录
如下: DELETE FROM categories a WHERE ( a.id, a.name, a.parent_id ) ) ) 关键点:oracle中有内部id为rowid, 在postgr ...
- spring容器的启动过程
spring的启动过程: 首先,对于一个web应用,其部署在web容器中,web容器提供其一个全局的上下文环境,这个上下文就是ServletContext,其为后面的spring IoC容器提供宿主环 ...
- Spring切面编程之AOP
AOP 是OOP 的延续,是Aspect Oriented Programming 的缩写,意思是面向切面编程.可以通过预编译方式和运行期动态代理实现在不修改源代码的情况下给程序动态统一添加功能的一种 ...
- python安装numpy
命令介绍: D:\computerSoft\python3.6.4\Scripts>python36 pip3.6.exe install numpy # 通过pip下载对应版本的numpy,然 ...
- memset 初始化数组 & 实现原理
初始化数组可不必使用n重for循环. 原理 memset具有初始化数组的功能,能够初始化数组中的每一个值. 它是将数组中的每一个数的二进制的每一个字节初始化的. 比如初始化int类型的a数组:mems ...
- python学习第二十五天函数位置参数和关键词参数
函数位置参数顾名思义就是按位置排序,按位置对应参数,位置一一对应,函数的关键词参数是不按照顺序来的,可以指定的参数传值.但是注意的是,位置参数必须在关键词参数之前. 1,函数位置参数 def good ...
- CodeForces 295B Greg and Graph (floyd+离线)
<题目链接> 题目大意:给定$n$个点的有向完全带权图$(n\leq500)$,现在进行$n$次操作,每次操作从图中删除一个点(每删除一个点,都会将与它相关联的边都删除),问你每次删点之前 ...
- k8s常用笔记
安装docker // 安装docker $ yum install -y docker-ce // 开机启动 && 启动服务 $ systemctl enable docker &a ...
- Address already in use : connect
Address already in use : connect 错误以及处理 项目中有过手写并发测试,在长时间的并发测试(超过20秒,美妙超过2000)的情况下出现了以上错误 处理方法如下(抄的) ...