WCF 自定义验证器
WCF Custom Validator
设置 CustomValidator 时出现以下错误:
无法加载文件或程序集 'Ringo.Authentication' 或其依赖项之一。系统找不到指定的文件。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using Ringo.Utilities;
namespace Ringo.Authentication
{
public class CustomUserNameValidator : UserNamePasswordValidator
{
public override void Validate(string Username, string Password)
{
Accounts account = new Accounts();
if (account.CheckUserAccount(Username, Password))
{
return;
}
throw new SecurityTokenException("Accout is Invalid");
}
}
}
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, Ringo.Authentication"/>
</serviceCredentials>
如有帮助将不胜感激!
以下:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo.Authentication**"/>
</serviceCredentials>
应该是:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo**"/>
</serviceCredentials>
设置 CustomValidator 时出现以下错误:
无法加载文件或程序集 'Ringo.Authentication' 或其依赖项之一。系统找不到指定的文件。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using Ringo.Utilities;
namespace Ringo.Authentication
{
public class CustomUserNameValidator : UserNamePasswordValidator
{
public override void Validate(string Username, string Password)
{
Accounts account = new Accounts();
if (account.CheckUserAccount(Username, Password))
{
return;
}
throw new SecurityTokenException("Accout is Invalid");
}
}
}
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, Ringo.Authentication"/>
</serviceCredentials>
如有帮助将不胜感激!
以下:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo.Authentication**"/>
</serviceCredentials>
应该是:
<serviceCredentials >
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo**"/>
</serviceCredentials>