This project is read-only.
1
Vote

Add Attributes other than string

description

Radius Attributes other than string are not handled and throw exceptions.
 
I've updated ConvertMessageToPacket in RadiusMessageEncodingFactory - (Only tested for int, which works)
 
if (outgoingProperties != null)
            {
                foreach (var pair in outgoingProperties)
                {
 
                    if(pair.Value.GetType() == Type.GetType("System.String"))
                    {
                        packet.Attributes.Add(new RadiusAttribute(pair.Key, (string)pair.Value));
                    }
                    else if (pair.Value.GetType() == Type.GetType("System.Int32"))
                    {
                        packet.Attributes.Add(new RadiusAttribute(pair.Key, (int)pair.Value));
                    }
                    else if (pair.Value.GetType() == Type.GetType("System.Byte[]"))
                    {
                        packet.Attributes.Add(new RadiusAttribute(pair.Key, (byte[])pair.Value));
                    }
                    else if (pair.Value.GetType() == Type.GetType("System.Net.IPAddress"))
                    {
                           packet.Attributes.Add(new RadiusAttribute(pair.Key, (System.Net.IPAddress)pair.Value));
                    }
                }
            }

comments