Esempio n. 1
0
        public void CheckLogOnCredential(string userName, string password, string computerName, Uri connectionUri, string configuration, string sourceIPAddressRemoteAddr, string sourceIPAddressHttpXForwardedFor)
        {
            string statusSuccess;
            string originalString;

            if (computerName != null ^ connectionUri != null)
            {
                if (this.AuthenticateUser(userName, password))
                {
                    if (this.AuthorizeSession(userName, computerName, connectionUri, configuration))
                    {
                        bool   flag = this.CheckUserSessionLimit(userName);
                        string str  = userName;
                        if (flag)
                        {
                            statusSuccess = Resources.Status_Success;
                        }
                        else
                        {
                            statusSuccess = Resources.Status_Failure;
                        }
                        PowwaEvents.PowwaEVENT_SESSION_LIMIT_CHECK(str, statusSuccess);
                        if (flag)
                        {
                            return;
                        }
                        else
                        {
                            PowwaEvents.PowwaEVENT_SESSION_LIMIT_REACHED(userName);
                            object[] objArray = new object[1];
                            objArray[0] = userName;
                            throw PowwaException.CreateLogOnFailureException(string.Format(CultureInfo.CurrentCulture, Resources.UserActiveSessionLimitReached, objArray));
                        }
                    }
                    else
                    {
                        string str1 = userName;
                        string str2 = sourceIPAddressRemoteAddr;
                        string str3 = sourceIPAddressHttpXForwardedFor;
                        string gatewayAuthorizationFailure = Resources.GatewayAuthorizationFailure;
                        if (connectionUri != null)
                        {
                            originalString = connectionUri.OriginalString;
                        }
                        else
                        {
                            originalString = computerName;
                        }
                        string str4  = configuration;
                        string empty = str4;
                        if (str4 == null)
                        {
                            empty = string.Empty;
                        }
                        PowwaEvents.PowwaEVENT_GATEWAY_AUTHORIZATION_FAILURE(str1, str2, str3, gatewayAuthorizationFailure, originalString, empty);
                        throw PowwaException.CreateLogOnFailureException(Resources.GatewayAuthorizationFailure);
                    }
                }
                else
                {
                    PowwaEvents.PowwaEVENT_AUTHENTICATION_FAILURE(userName, sourceIPAddressRemoteAddr, sourceIPAddressHttpXForwardedFor, Resources.LoginFailure);
                    throw PowwaException.CreateLogOnFailureException(Resources.LoginFailure);
                }
            }
            else
            {
                throw new ArgumentException("computerName and connectionUri are mutually exclusive", "computerName");
            }
        }