// Token: 0x06001219 RID: 4633 RVA: 0x0006E1D4 File Offset: 0x0006C3D4 internal void BeginSend(OwaContext owaContext, HttpRequest originalRequest, SerializedClientSecurityContext serializedContext, AsyncCallback callback, object extraData) { ExTraceGlobals.ProxyCallTracer.TraceDebug(0L, "ProxyLogonRequest.BeginSend"); string proxyRequestBody = serializedContext.Serialize(); base.BeginSend(owaContext, originalRequest, OwaUrl.ProxyLogon.GetExplicitUrl(owaContext), proxyRequestBody, callback, extraData); }
// Token: 0x06001394 RID: 5012 RVA: 0x00078990 File Offset: 0x00076B90 public static SerializedClientSecurityContext CreateFromOwaIdentity(OwaIdentity owaIdentity) { SerializedClientSecurityContext serializedClientSecurityContext = new SerializedClientSecurityContext(); owaIdentity.ClientSecurityContext.SetSecurityAccessToken(serializedClientSecurityContext); serializedClientSecurityContext.LogonName = owaIdentity.GetLogonName(); serializedClientSecurityContext.AuthenticationType = owaIdentity.AuthenticationType; return(serializedClientSecurityContext); }
// Token: 0x060011F4 RID: 4596 RVA: 0x0006CC0C File Offset: 0x0006AE0C private void SendProxyLogonRequest() { ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyEventHandler.SendProxyLogonRequest"); this.proxyLogonAttempts++; if (this.proxyLogonAttempts > 2) { this.asyncResult.Exception = new OwaInvalidOperationException("Both attempts to send the proxy request failed -- the server returned HTTP " + 441 + " (need identity) twice in a row"); this.asyncResult.CompleteRequest(false); return; } this.proxyLogonRequest = new ProxyLogonRequest(); SerializedClientSecurityContext serializedContext = SerializedClientSecurityContext.CreateFromOwaIdentity(base.OwaContext.LogonIdentity); this.proxyLogonRequest.BeginSend(base.OwaContext, this.OriginalRequest, serializedContext, new AsyncCallback(this.ProxyLogonCallback), this); }
// Token: 0x060013A2 RID: 5026 RVA: 0x00078B90 File Offset: 0x00076D90 internal static SerializedClientSecurityContext Deserialize(Stream input) { XmlTextReader xmlTextReader = null; SerializedClientSecurityContext result; try { xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(input); xmlTextReader.WhitespaceHandling = WhitespaceHandling.All; SerializedClientSecurityContext serializedClientSecurityContext = SerializedClientSecurityContext.Deserialize(xmlTextReader); result = serializedClientSecurityContext; } finally { if (xmlTextReader != null) { xmlTextReader.Close(); } } return(result); }
// Token: 0x0600139F RID: 5023 RVA: 0x00078A20 File Offset: 0x00076C20 public void Serialize(XmlTextWriter writer) { writer.WriteStartElement(SerializedClientSecurityContext.rootElementName); writer.WriteAttributeString(SerializedClientSecurityContext.authenticationTypeAttributeName, this.authenticationType); writer.WriteAttributeString(SerializedClientSecurityContext.logonNameAttributeName, this.logonName); SerializedClientSecurityContext.WriteSid(writer, this.UserSid, 0U, SerializedClientSecurityContext.SidType.User); if (this.GroupSids != null) { for (int i = 0; i < this.GroupSids.Length; i++) { SerializedClientSecurityContext.WriteSid(writer, this.GroupSids[i].SecurityIdentifier, this.GroupSids[i].Attributes, SerializedClientSecurityContext.SidType.Group); } } if (this.RestrictedGroupSids != null) { for (int j = 0; j < this.RestrictedGroupSids.Length; j++) { SerializedClientSecurityContext.WriteSid(writer, this.RestrictedGroupSids[j].SecurityIdentifier, this.RestrictedGroupSids[j].Attributes, SerializedClientSecurityContext.SidType.RestrictedGroup); } } writer.WriteEndElement(); }
internal void BeginSend(OwaContext owaContext, HttpRequest originalRequest, OwaIdentity identity, CultureInfo culture, string timeZoneKeyName, bool isOptimized, string destination, AsyncCallback callback, object extraData) { ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyLanguagePostRequest.BeginSend"); StringWriter stringWriter = null; XmlTextWriter xmlTextWriter = null; string proxyRequestBody = null; try { stringWriter = new StringWriter(); xmlTextWriter = new XmlTextWriter(stringWriter); xmlTextWriter.WriteStartElement(ProxyLanguagePostRequest.rootElementName); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.localeIdAttributeName, culture.LCID.ToString()); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.timeZoneKeyNameAttributeName, timeZoneKeyName); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.isOptimizedAttributeName, isOptimized ? "1" : "0"); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.destinationAttributeName, destination); SerializedClientSecurityContext serializedClientSecurityContext = SerializedClientSecurityContext.CreateFromOwaIdentity(identity); serializedClientSecurityContext.Serialize(xmlTextWriter); xmlTextWriter.WriteEndElement(); stringWriter.Flush(); proxyRequestBody = stringWriter.ToString(); ExTraceGlobals.ProxyDataTracer.TraceDebug <int, string, bool>((long)this.GetHashCode(), "Sending xml payload with lcid={0}, tzid={1}, isOptimized={2}", culture.LCID, timeZoneKeyName, isOptimized); } finally { if (stringWriter != null) { stringWriter.Close(); } if (xmlTextWriter != null) { xmlTextWriter.Close(); } } base.BeginSend(owaContext, originalRequest, OwaUrl.LanguagePost.GetExplicitUrl(originalRequest), proxyRequestBody, callback, extraData); }
// Token: 0x060013A3 RID: 5027 RVA: 0x00078BD8 File Offset: 0x00076DD8 internal static SerializedClientSecurityContext Deserialize(XmlTextReader reader) { SerializedClientSecurityContext serializedClientSecurityContext = new SerializedClientSecurityContext(); serializedClientSecurityContext.UserSid = null; serializedClientSecurityContext.GroupSids = null; serializedClientSecurityContext.RestrictedGroupSids = null; try { List <SidStringAndAttributes> list = new List <SidStringAndAttributes>(); List <SidStringAndAttributes> list2 = new List <SidStringAndAttributes>(); if (!reader.Read() || XmlNodeType.Element != reader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.rootElementName) != 0) { SerializedClientSecurityContext.ThrowParserException(reader, "Missing or invalid root node"); } if (reader.MoveToFirstAttribute()) { do { if (StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.authenticationTypeAttributeName) == 0) { if (serializedClientSecurityContext.authenticationType != null) { SerializedClientSecurityContext.ThrowParserException(reader, string.Format("Duplicated attribute {0}", SerializedClientSecurityContext.authenticationTypeAttributeName)); } serializedClientSecurityContext.authenticationType = reader.Value; } else if (StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.logonNameAttributeName) == 0) { if (serializedClientSecurityContext.logonName != null) { SerializedClientSecurityContext.ThrowParserException(reader, string.Format("Duplicated attribute {0}", SerializedClientSecurityContext.logonNameAttributeName)); } serializedClientSecurityContext.logonName = reader.Value; } else { SerializedClientSecurityContext.ThrowParserException(reader, "Found invalid attribute in root element"); } }while (reader.MoveToNextAttribute()); } if (serializedClientSecurityContext.authenticationType == null || serializedClientSecurityContext.logonName == null) { SerializedClientSecurityContext.ThrowParserException(reader, "Auth type or logon name attributes are missing"); } bool flag = false; int num = 0; while (reader.Read()) { if (XmlNodeType.EndElement == reader.NodeType && StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.rootElementName) == 0) { flag = true; break; } if (XmlNodeType.Element != reader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.sidElementName) != 0) { SerializedClientSecurityContext.ThrowParserException(reader, "Expecting SID node"); } SerializedClientSecurityContext.SidType sidType = SerializedClientSecurityContext.SidType.User; uint num2 = 0U; if (reader.MoveToFirstAttribute()) { do { if (StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.sidTypeAttributeName) == 0) { int num3 = int.Parse(reader.Value); if (num3 == 1) { sidType = SerializedClientSecurityContext.SidType.Group; } else if (num3 == 2) { sidType = SerializedClientSecurityContext.SidType.RestrictedGroup; } else { SerializedClientSecurityContext.ThrowParserException(reader, "Invalid SID type"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(reader.Name, SerializedClientSecurityContext.sidAttributesAttributeName) == 0) { num2 = uint.Parse(reader.Value); } else { SerializedClientSecurityContext.ThrowParserException(reader, "Found invalid attribute in SID element"); } }while (reader.MoveToNextAttribute()); } if (sidType == SerializedClientSecurityContext.SidType.User) { if (num2 != 0U) { SerializedClientSecurityContext.ThrowParserException(reader, "'Attributes' shouldn't be set in an user SID"); } else if (serializedClientSecurityContext.UserSid != null) { SerializedClientSecurityContext.ThrowParserException(reader, "There can only be one user SID in the XML document"); } } if (!reader.Read() || XmlNodeType.Text != reader.NodeType || string.IsNullOrEmpty(reader.Value)) { SerializedClientSecurityContext.ThrowParserException(reader, "Expecting SID value in SDDL format"); } string value = reader.Value; if (sidType == SerializedClientSecurityContext.SidType.User) { serializedClientSecurityContext.UserSid = value; } else if (sidType == SerializedClientSecurityContext.SidType.Group) { SidStringAndAttributes item = new SidStringAndAttributes(value, num2); list.Add(item); } else if (sidType == SerializedClientSecurityContext.SidType.RestrictedGroup) { SidStringAndAttributes item2 = new SidStringAndAttributes(value, num2); list2.Add(item2); } if (!reader.Read() || XmlNodeType.EndElement != reader.NodeType) { SerializedClientSecurityContext.ThrowParserException(reader, "Expected end of SID node"); } num++; if (num > SerializedClientSecurityContext.MaximumSidsPerContext) { throw new OwaSecurityContextSidLimitException(string.Format("Too many SID nodes in the request, maximum is {0}", SerializedClientSecurityContext.MaximumSidsPerContext), serializedClientSecurityContext.logonName, serializedClientSecurityContext.authenticationType); } } if (serializedClientSecurityContext.UserSid == null) { SerializedClientSecurityContext.ThrowParserException(reader, "Serialized context should at least contain an user SID"); } if (!flag) { SerializedClientSecurityContext.ThrowParserException(reader, "Parsing error"); } if (list.Count > 0) { serializedClientSecurityContext.GroupSids = list.ToArray(); } if (list2.Count > 0) { serializedClientSecurityContext.RestrictedGroupSids = list2.ToArray(); } } catch (XmlException ex) { SerializedClientSecurityContext.ThrowParserException(reader, string.Format("Parser threw an XML exception: {0}", ex.Message)); } return(serializedClientSecurityContext); }
internal static void ParseProxyLanguagePostBody(Stream bodyStream, out CultureInfo culture, out string timeZoneKeyName, out bool isOptimized, out string destination, out SerializedClientSecurityContext serializedContext) { ExTraceGlobals.ProxyCallTracer.TraceDebug(0L, "ProxyLanguagePostRequest.ParseProxyLanguagePostBody"); culture = null; timeZoneKeyName = string.Empty; isOptimized = false; destination = string.Empty; serializedContext = null; XmlTextReader xmlTextReader = null; try { xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(bodyStream); xmlTextReader.WhitespaceHandling = WhitespaceHandling.All; if (!xmlTextReader.Read() || XmlNodeType.Element != xmlTextReader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.rootElementName) != 0) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Missing or invalid root node"); } if (xmlTextReader.MoveToFirstAttribute()) { do { if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.timeZoneKeyNameAttributeName) == 0) { if (DateTimeUtilities.IsValidTimeZoneKeyName(xmlTextReader.Value)) { timeZoneKeyName = xmlTextReader.Value; ExTraceGlobals.ProxyDataTracer.TraceDebug <string>(0L, "Found timeZoneKeyName={0}", timeZoneKeyName); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid time zone id"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.localeIdAttributeName) == 0) { int num = -1; if (int.TryParse(xmlTextReader.Value, out num) && Culture.IsSupportedCulture(num)) { culture = Culture.GetCultureInfoInstance(num); ExTraceGlobals.ProxyDataTracer.TraceDebug <int>(0L, "Found localeId={0}", num); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid locale id"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.isOptimizedAttributeName) == 0) { int num2 = -1; if (int.TryParse(xmlTextReader.Value, out num2)) { isOptimized = (num2 == 1); ExTraceGlobals.ProxyDataTracer.TraceDebug <bool>(0L, "Found isOptimized={0}", isOptimized); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid is-optimized value"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.destinationAttributeName) == 0) { destination = xmlTextReader.Value; } else { ExTraceGlobals.ProxyTracer.TraceDebug(0L, "ProxyLanguagePostRequest.ParseProxyLanguagePostBody - Found invalid attribute, ignoring it."); } }while (xmlTextReader.MoveToNextAttribute()); } ExTraceGlobals.ProxyTracer.TraceDebug(0L, "Deserializing client context..."); serializedContext = SerializedClientSecurityContext.Deserialize(xmlTextReader); if (!xmlTextReader.Read() || XmlNodeType.EndElement != xmlTextReader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.rootElementName) != 0) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Missing or invalid root node"); } } catch (XmlException ex) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, string.Format("Parser threw an XML exception: {0}", ex.Message)); } finally { xmlTextReader.Close(); } }