/// <summary> /// 认证 /// </summary> /// <param name="strUserID"></param> /// <param name="strPassword"></param> /// <param name="context">一些额外的参数</param> /// <returns></returns> public ISignInUserInfo Authenticate(string strUserID, string strPassword, Dictionary <string, object> context) { LogOnIdentity loi = new LogOnIdentity(strUserID, strPassword); DefaultSignInUserInfo signInUserInfo = new DefaultSignInUserInfo(); string authCode = context.GetValue("AuthenticationCode", string.Empty); //是否使用验证码认证 if (authCode.IsNotEmpty()) { AuthenticationCodeAdapter.Instance.CheckAuthenticationCode(authCode, strPassword); } else { if (AuthenticateUser(loi) == false) { IEnumerable <string> alternativeUserIDs = context.GetValue("AlternativeUserIDs", (IEnumerable <string>)null); if (AuthenticateAlternativeUserIDs(alternativeUserIDs, strPassword, context) == false) { AuthenticateException.ThrowAuthenticateException(loi.LogOnNameWithoutDomain); } } } signInUserInfo.UserID = loi.LogOnNameWithoutDomain; signInUserInfo.Domain = loi.Domain; return(signInUserInfo); }
/// <summary> /// 认证 /// </summary> /// <param name="strUserID"></param> /// <param name="strPassword"></param> /// <returns></returns> public ISignInUserInfo Authenticate(string strUserID, string strPassword) { LogOnIdentity loi = new LogOnIdentity(strUserID, strPassword); DefaultSignInUserInfo signInUserInfo = new DefaultSignInUserInfo(); if (AuthenticateUser(loi) == false) { AuthenticateException.ThrowAuthenticateException(loi.LogOnNameWithoutDomain); } signInUserInfo.UserID = loi.LogOnNameWithoutDomain; signInUserInfo.Domain = loi.Domain; return(signInUserInfo); }