/// <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>
        /// <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);
        }
Beispiel #3
0
        /// <summary>
        /// 根据UserID创建SignInInfo
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="bDontSaveUserID"></param>
        /// <param name="bAutoSignIn"></param>
        /// <returns></returns>
        public static ISignInInfo Create(string userID, bool bDontSaveUserID, bool bAutoSignIn)
        {
            LogOnIdentity loi = new LogOnIdentity(userID);

            DefaultSignInUserInfo userInfo = new DefaultSignInUserInfo();

            userInfo.UserID = loi.LogOnNameWithoutDomain;
            userInfo.Domain = loi.Domain;

            return(Create(userInfo, bDontSaveUserID, bAutoSignIn));
        }
		/// <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;
		}
Beispiel #5
0
        /// <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);
        }
Beispiel #6
0
		protected ISignInUserInfo signInControl_InitSignInControl()
		{
			DefaultSignInUserInfo result = null;

			string openID = Request.QueryString.GetValue("openID", string.Empty);

			if (openID.IsNotEmpty())
			{
				OpenIDBinding binding = PassportSignInSettings.GetConfig().PersistOpenIDBinding.GetBindingByOpenID(openID);

				if (binding != null)
				{
					result = new DefaultSignInUserInfo();

					string logonName = PassportSignInSettings.GetConfig().UserIDConverter.GetUserLogonName(binding.UserID);

					result.UserID = logonName;
					result.OriginalUserID = logonName;
				}
			}

			return result;
		}
Beispiel #7
0
        /// <summary>
        /// 根据UserID创建SignInInfo
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="bDontSaveUserID"></param>
        /// <param name="bAutoSignIn"></param>
        /// <returns></returns>
        public static ISignInInfo Create(string userID, bool bDontSaveUserID, bool bAutoSignIn)
        {
            LogOnIdentity loi = new LogOnIdentity(userID);

            DefaultSignInUserInfo userInfo = new DefaultSignInUserInfo();

            userInfo.UserID = loi.LogOnNameWithoutDomain;
            userInfo.Domain = loi.Domain;

            return Create(userInfo, bDontSaveUserID, bAutoSignIn);
        }