CustomUserNameSecurityTokenAuthenticator.ValidateUserNamePasswordCore(String, String) 方法
定义
对指定的用户名和密码进行身份验证,并返回 UserNameSecurityToken 安全令牌的授权策略集。Authenticates the specified user name and password and returns the set of authorization policies for UserNameSecurityToken security tokens.
protected:
override System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Policy::IAuthorizationPolicy ^> ^ ValidateUserNamePasswordCore(System::String ^ userName, System::String ^ password);
protected override System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Policy.IAuthorizationPolicy> ValidateUserNamePasswordCore (string userName, string password);
override this.ValidateUserNamePasswordCore : string * string -> System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Policy.IAuthorizationPolicy>
Protected Overrides Function ValidateUserNamePasswordCore (userName As String, password As String) As ReadOnlyCollection(Of IAuthorizationPolicy)
参数
- userName
- String
与安全令牌相关联的用户名。The user name associated with the security token.
- password
- String
与安全令牌相关联的密码。The password associated with the security token.
返回
一个类型为 ReadOnlyCollection<T> 的 IAuthorizationPolicy,它包含对此应用程序生效的授权策略集。A ReadOnlyCollection<T> of type IAuthorizationPolicy that contains the set of authorization policies in effect for this application.
例外
userName 为 null。userName is null.
userName 和 password 的组合无效。userName and password combination are not valid.
注解
ValidateUserNamePasswordCore 方法使用传递到 UserNamePasswordValidator 构造函数中的 CustomUserNameSecurityTokenAuthenticator 对用户进行身份验证。The ValidateUserNamePasswordCore method uses the UserNamePasswordValidator passed into the CustomUserNameSecurityTokenAuthenticator constructor to authenticate the user.
当无法验证用户名和密码时,引发 SecurityTokenValidationException。When the username and password cannot be validated, throw the SecurityTokenValidationException.
当不存在对此应用程序生效的授权策略时,返回 ReadOnlyCollection<T> 类型的空 IAuthorizationPolicy。When there are no authorization policies in effect for this application, return an empty ReadOnlyCollection<T> of type IAuthorizationPolicy.
当 ValidateUserNamePasswordCore 方法返回时 null ,Windows Communication Foundation 引发 SecurityTokenValidationException 。When the ValidateUserNamePasswordCore method returns null, Windows Communication Foundation throws a SecurityTokenValidationException.