コード例 #1
0
        protected override void OnBeginRequestInternal(HttpApplication httpApplication)
        {
            ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[RpsHttpProxyModule::OnBeginRequestInternal] Enter");
            HttpContext          context = httpApplication.Context;
            RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context);

            if (current != null)
            {
                RequestMonitor.Instance.RegisterRequest(current.ActivityId);
                string text = context.Request.Headers["Authorization"];
                byte[] bytes;
                byte[] array;
                if (!string.IsNullOrEmpty(text) && LiveIdBasicAuthModule.ParseCredentials(context, text, false, out bytes, out array))
                {
                    string      text2       = Encoding.UTF8.GetString(bytes).Trim();
                    SmtpAddress smtpAddress = new SmtpAddress(text2);
                    RequestMonitor.Instance.Log(current.ActivityId, RequestMonitorMetadata.AuthenticatedUser, text2);
                    RequestMonitor.Instance.Log(current.ActivityId, RequestMonitorMetadata.Organization, smtpAddress.Domain);
                    context.Items[Constants.WLIDMemberName] = text2;
                    ExTraceGlobals.HttpModuleTracer.TraceDebug <string>((long)this.GetHashCode(), "[RpsHttpProxyModule::OnBeginRequestInternal] LiveIdMember={0}", text2);
                }
            }
            base.OnBeginRequestInternal(httpApplication);
            ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[RpsHttpProxyModule::OnBeginRequestInternal] Exit");
        }
        // Token: 0x0600000B RID: 11 RVA: 0x0000220C File Offset: 0x0000040C
        private static CommonAccessToken CommonAccessTokenFromUrl(string user, Uri requestURI, out Exception ex)
        {
            if (requestURI == null)
            {
                throw new ArgumentNullException("requestURI");
            }
            ex = null;
            CommonAccessToken   result = null;
            NameValueCollection nameValueCollectionFromUri = LiveIdBasicAuthModule.GetNameValueCollectionFromUri(requestURI);
            string text = nameValueCollectionFromUri.Get("X-Rps-CAT");

            if (!string.IsNullOrWhiteSpace(text))
            {
                try
                {
                    result = CommonAccessToken.Deserialize(Uri.UnescapeDataString(text));
                }
                catch (Exception ex2)
                {
                    Logger.TraceError(ExTraceGlobals.RemotePowershellBackendCmdletProxyModuleTracer, "Got exception when trying to parse CommonAccessToken: {0}.", new object[]
                    {
                        ex2.ToString()
                    });
                    Logger.LogEvent(TaskEventLogConstants.Tuple_LogInvalidCommonAccessTokenReceived, text, new object[]
                    {
                        user,
                        requestURI.ToString(),
                        Strings.ErrorWhenParsingCommonAccessToken(ex2.ToString())
                    });
                    ex = ex2;
                }
            }
            return(result);
        }
        // Token: 0x060013F0 RID: 5104 RVA: 0x00046318 File Offset: 0x00044518
        internal static ExchangeRunspaceConfigurationSettings FromUriConnectionString(string connectionString, ExchangeRunspaceConfigurationSettings.ExchangeApplication defaultApplication, out string vdirPath)
        {
            Uri uri = new Uri(connectionString, UriKind.Absolute);

            vdirPath = ExchangeRunspaceConfigurationSettings.GetVDirPathFromUriLocalPath(uri);
            if (string.IsNullOrEmpty(uri.Query))
            {
                return(ExchangeRunspaceConfigurationSettings.GetDefaultInstance());
            }
            NameValueCollection nameValueCollectionFromUri = LiveIdBasicAuthModule.GetNameValueCollectionFromUri(uri);

            return(ExchangeRunspaceConfigurationSettings.CreateConfigurationSettingsFromNameValueCollection(uri, nameValueCollectionFromUri, defaultApplication));
        }
コード例 #4
0
        // Token: 0x06000004 RID: 4 RVA: 0x000020E0 File Offset: 0x000002E0
        public bool TryParseUserToken(HttpContext context, out string userToken)
        {
            Logger.EnterFunction(ExTraceGlobals.FailFastModuleTracer, "BasicLiveIDAuthUserTokenParser.TryParseUserToken");
            userToken = null;
            if (context == null || context.Request == null)
            {
                Logger.TraceDebug(ExTraceGlobals.FailFastModuleTracer, "Context or Context.Request is null.", new object[0]);
                return(false);
            }
            string text = context.Request.Headers["X-WLID-MemberName"];

            if (!string.IsNullOrEmpty(text))
            {
                userToken = text;
            }
            else
            {
                string text2 = context.Request.Headers["Authorization"];
                byte[] bytes;
                byte[] array;
                if (!LiveIdBasicAuthModule.ParseCredentials(context, text2, false, out bytes, out array))
                {
                    Logger.TraceDebug(ExTraceGlobals.FailFastModuleTracer, "Auth header \"{0}\" is not Basic LiveID Auth format. Ignore this request in BasicLiveIDAuthUserTokenParser.", new object[]
                    {
                        text2
                    });
                    return(false);
                }
                userToken = Encoding.ASCII.GetString(bytes);
            }
            Logger.TraceDebug(ExTraceGlobals.FailFastModuleTracer, "Parse auth header and get user token {0}.", new object[]
            {
                userToken
            });
            Logger.ExitFunction(ExTraceGlobals.FailFastModuleTracer, "BasicLiveIDAuthUserTokenParser.TryParseUserToken");
            return(true);
        }
コード例 #5
0
        private string ExpandVersions(string connectionString)
        {
            Uri uri = new Uri(connectionString, UriKind.Absolute);
            NameValueCollection nameValueCollectionFromUri = LiveIdBasicAuthModule.GetNameValueCollectionFromUri(uri);
            string        text                 = nameValueCollectionFromUri.Get("ExchClientVer");
            string        text2                = nameValueCollectionFromUri.Get("ClientApplication");
            StringBuilder stringBuilder        = new StringBuilder();
            string        supportedEMCVersions = AppSettings.Current.SupportedEMCVersions;

            if (supportedEMCVersions.Contains("*"))
            {
                if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && text2.Equals("EMC", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        ExchangeBuild exchangeBuild = ExchangeBuild.Parse(text);
                        string[]      array         = supportedEMCVersions.Split(new char[]
                        {
                            ';'
                        });
                        foreach (string text3 in array)
                        {
                            if (!string.IsNullOrEmpty(text3))
                            {
                                if (text3.Contains("*"))
                                {
                                    string[] array3 = text3.Split(new char[]
                                    {
                                        '.'
                                    });
                                    int num;
                                    int num2;
                                    if (array3.Length == 4 && int.TryParse(array3[0], out num) && num == (int)exchangeBuild.Major && (string.Equals(array3[1], "*") || (int.TryParse(array3[1], out num2) && num2 == (int)exchangeBuild.Minor && string.Equals(array3[2], "*"))))
                                    {
                                        for (int j = 1; j < 999; j++)
                                        {
                                            stringBuilder.Append(string.Format(";{0}.{1}.{2}.0", exchangeBuild.Major, exchangeBuild.Minor, j));
                                        }
                                        break;
                                    }
                                }
                                else
                                {
                                    stringBuilder.Append(string.Format(";{0}", text3));
                                }
                            }
                        }
                        goto IL_1D3;
                    }
                    catch (ArgumentException)
                    {
                        stringBuilder.Append(SupportedVersionList.DefaultVersionString);
                        goto IL_1D3;
                    }
                }
                stringBuilder.Append(SupportedVersionList.DefaultVersionString);
            }
            else
            {
                stringBuilder.Append(supportedEMCVersions);
            }
IL_1D3:
            return(stringBuilder.ToString());
        }
コード例 #6
0
 // Token: 0x060001D1 RID: 465 RVA: 0x00008AF6 File Offset: 0x00006CF6
 public override void ContinueOnAuthenticate(HttpApplication app, AsyncCallback callback)
 {
     LiveIdBasicAuthModule.ContinueOnAuthenticate(app, null, callback, null);
 }