Ejemplo n.º 1
0
        // Token: 0x06000EB7 RID: 3767 RVA: 0x0005D690 File Offset: 0x0005B890
        protected override Hashtable ParseParameters()
        {
            NameValueCollection queryString = base.EventHandler.HttpContext.Request.QueryString;

            if (queryString.Count == 0)
            {
                return(base.ParameterTable);
            }
            for (int i = 0; i < queryString.Count; i++)
            {
                string key = queryString.GetKey(i);
                if (string.IsNullOrEmpty(key))
                {
                    this.ThrowParserException("Parameter name is empty. Url=" + base.EventHandler.HttpContext.Request.RawUrl);
                }
                if (string.CompareOrdinal(key, "ns") != 0 && string.CompareOrdinal(key, "ev") != 0 && string.CompareOrdinal(key, "oeh") != 0 && string.CompareOrdinal(key, "cpc") != 0 && string.CompareOrdinal(key, "calist") != 0 && string.CompareOrdinal(key, "pfmk") != 0 && string.CompareOrdinal(key, Globals.RealmParameter) != 0)
                {
                    OwaEventParameterAttribute paramInfo = base.GetParamInfo(key);
                    if (paramInfo.IsStruct || paramInfo.IsArray)
                    {
                        this.ThrowParserException("Structs and arrays are not supported in GET requests");
                    }
                    string text = queryString[i];
                    if (text == null)
                    {
                        base.AddEmptyParameter(paramInfo);
                    }
                    else
                    {
                        base.AddSimpleTypeParameter(paramInfo, text);
                    }
                }
            }
            return(base.ParameterTable);
        }
Ejemplo n.º 2
0
 protected void AddEmptyItemToArray(OwaEventParameterAttribute paramInfo, ArrayList itemArray)
 {
     if (paramInfo.IsStruct)
     {
         this.ThrowParserException("Empty structs not supported");
         return;
     }
     this.AddSimpleTypeParameter(paramInfo, string.Empty);
 }
Ejemplo n.º 3
0
        protected OwaEventParameterAttribute GetParamInfo(string name)
        {
            OwaEventParameterAttribute owaEventParameterAttribute = this.EventHandler.EventInfo.FindParameterInfo(name);

            if (owaEventParameterAttribute == null)
            {
                this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Parameter '{0}' is unknown.", new object[]
                {
                    name
                }));
            }
            return(owaEventParameterAttribute);
        }
Ejemplo n.º 4
0
        protected void AddSimpleTypeParameter(OwaEventParameterAttribute paramInfo, string value)
        {
            object value2;

            if (paramInfo.Type == typeof(string))
            {
                value2 = value;
            }
            else
            {
                value2 = this.ConvertToStrongType(paramInfo.Type, value);
            }
            this.AddParameter(paramInfo, value2);
        }
Ejemplo n.º 5
0
        protected void AddSimpleTypeToArray(OwaEventParameterAttribute paramInfo, ArrayList itemArray, string value)
        {
            object value2;

            if (paramInfo.Type == typeof(string))
            {
                value2 = value;
            }
            else
            {
                value2 = this.ConvertToStrongType(paramInfo.Type, value);
            }
            this.AddItemToArray(itemArray, value2);
        }
Ejemplo n.º 6
0
 protected void AddEmptyParameter(OwaEventParameterAttribute paramInfo)
 {
     if (paramInfo.IsStruct && !paramInfo.IsArray)
     {
         this.ThrowParserException("Empty structs not supported");
         return;
     }
     if (paramInfo.IsArray)
     {
         this.AddArrayParameter(paramInfo, new ArrayList());
         return;
     }
     this.AddSimpleTypeParameter(paramInfo, string.Empty);
 }
Ejemplo n.º 7
0
 protected void AddParameter(OwaEventParameterAttribute paramInfo, object value)
 {
     if (this.parameterTable.Count >= 64)
     {
         this.ThrowParserException("Reached maximum number of parameters");
     }
     if ((this.setMask & paramInfo.ParameterMask) != 0UL)
     {
         this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Parameter '{0}' is found twice", new object[]
         {
             paramInfo.Name
         }));
     }
     this.setMask |= paramInfo.ParameterMask;
     this.parameterTable.Add(paramInfo.Name, value);
 }
        // Token: 0x06000E83 RID: 3715 RVA: 0x0005C6BC File Offset: 0x0005A8BC
        protected override Hashtable ParseParameters()
        {
            Dictionary <string, object> internalHandlerParameters = OwaContext.Current.InternalHandlerParameters;

            if (internalHandlerParameters == null)
            {
                this.ThrowParserException("Internal parameters are not set");
            }
            foreach (string text in internalHandlerParameters.Keys)
            {
                object obj = internalHandlerParameters[text];
                OwaEventParameterAttribute paramInfo = base.GetParamInfo(text);
                Type type = obj.GetType();
                if (type != paramInfo.Type && !type.IsSubclassOf(paramInfo.Type))
                {
                    this.ThrowParserException("Parameter is not of the correct type");
                }
                base.AddParameter(paramInfo, obj);
            }
            return(base.ParameterTable);
        }
Ejemplo n.º 9
0
 protected void AddStructToArray(OwaEventParameterAttribute paramInfo, ArrayList itemArray, object value)
 {
     this.AddItemToArray(itemArray, value);
 }
Ejemplo n.º 10
0
        protected void AddArrayParameter(OwaEventParameterAttribute paramInfo, ArrayList itemArray)
        {
            Array value = itemArray.ToArray(paramInfo.Type);

            this.AddParameter(paramInfo, value);
        }
Ejemplo n.º 11
0
 protected void AddStructParameter(OwaEventParameterAttribute paramInfo, object value)
 {
     this.AddParameter(paramInfo, value);
 }
 // Token: 0x06000E35 RID: 3637 RVA: 0x0005B927 File Offset: 0x00059B27
 internal void AddParameterInfo(OwaEventParameterAttribute paramInfo)
 {
     this.paramInfoTable.Add(paramInfo.Name, paramInfo);
 }
Ejemplo n.º 13
0
        private static void ScanHandlerAttributes(MethodInfo method, OwaEventAttribute eventInfo, Type objectIdType)
        {
            object[] customAttributes = method.GetCustomAttributes(typeof(OwaEventVerbAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                OwaEventVerbAttribute owaEventVerbAttribute = (OwaEventVerbAttribute)customAttributes[0];
                eventInfo.AllowedVerbs = owaEventVerbAttribute.Verb;
            }
            else
            {
                eventInfo.AllowedVerbs = OwaEventVerb.Post;
            }
            customAttributes = method.GetCustomAttributes(typeof(OwaEventSegmentationAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                OwaEventSegmentationAttribute owaEventSegmentationAttribute = (OwaEventSegmentationAttribute)customAttributes[0];
                eventInfo.SegmentationFlags = owaEventSegmentationAttribute.SegmentationFlags;
            }
            else
            {
                eventInfo.SegmentationFlags = 0UL;
            }
            ExTraceGlobals.OehDataTracer.TraceDebug <string, OwaEventVerb>(0L, "Event handler found. Name: '{0}'. Allowed verbs: '{1}'.", eventInfo.Name, eventInfo.AllowedVerbs);
            ulong num  = 0UL;
            int   num2 = 0;

            if (Globals.CanaryProtectionRequired)
            {
                eventInfo.AddParameterInfo(new OwaEventParameterAttribute("canary", typeof(string)));
            }
            customAttributes = method.GetCustomAttributes(typeof(OwaEventParameterAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                if (customAttributes.Length >= 64)
                {
                    throw new OwaNotSupportedException("Event handler declares more parameters than allowed");
                }
                if ((eventInfo.AllowedVerbs & OwaEventVerb.Get) != OwaEventVerb.Unsupported && customAttributes.Length > 16)
                {
                    throw new OwaNotSupportedException("Event handler declares more parameters than allowed for a GET request");
                }
                foreach (OwaEventParameterAttribute owaEventParameterAttribute in customAttributes)
                {
                    if (objectIdType != null && owaEventParameterAttribute.Type == typeof(ObjectId))
                    {
                        owaEventParameterAttribute = new OwaEventParameterAttribute(owaEventParameterAttribute.Name, objectIdType, owaEventParameterAttribute.IsArray, owaEventParameterAttribute.IsOptional);
                    }
                    if (!eventInfo.IsInternal && !OwaEventRegistry.IsAllowedType(owaEventParameterAttribute.Type))
                    {
                        string message = string.Format("Event handler is using a type that is not supported method: '{0}' param type '{1}'", method.Name, owaEventParameterAttribute.Type);
                        throw new OwaNotSupportedException(message);
                    }
                    if (string.Equals(owaEventParameterAttribute.Name, "ns", StringComparison.Ordinal) || string.Equals(owaEventParameterAttribute.Name, "ev", StringComparison.Ordinal))
                    {
                        throw new OwaNotSupportedException("Handler is trying to use a reserve name for a parameter");
                    }
                    if (OwaEventRegistry.structTypeTable[owaEventParameterAttribute.Type] != null)
                    {
                        owaEventParameterAttribute.IsStruct = true;
                    }
                    owaEventParameterAttribute.ParameterMask = 1UL << num2;
                    if (!owaEventParameterAttribute.IsOptional)
                    {
                        num |= owaEventParameterAttribute.ParameterMask;
                    }
                    eventInfo.AddParameterInfo(owaEventParameterAttribute);
                    num2++;
                    ExTraceGlobals.OehDataTracer.TraceDebug(0L, "Event handler parameter found, name: '{0}', type: '{1}', isArray: '{2}', isOptional: '{3}', isStruct: '{4}'", new object[]
                    {
                        owaEventParameterAttribute.Name,
                        owaEventParameterAttribute.Type,
                        owaEventParameterAttribute.IsArray,
                        owaEventParameterAttribute.IsOptional,
                        owaEventParameterAttribute.IsStruct
                    });
                }
            }
            eventInfo.RequiredMask = num;
        }