Exemple #1
0
        /// <summary>
        /// Inflate the token
        /// NOTE: This operation is not continuable and assumes that the entire token is available in the stream
        /// </summary>
        /// <param name="source">Stream to inflate the token from.</param>
        /// <returns>True in case of success, false otherwise.</returns>
        public override bool Inflate(Stream source)
        {
            // We skip the token identifier because it is read by token factory
            TDSFedAuthInfoId currentFeatureType = TDSFedAuthInfoId.Invalid;

            uint infoDataLength = 0;
            uint infoDataOffset = 0;

            uint tokenLength = TDSUtilities.ReadUInt(source);
            uint countOfIds  = TDSUtilities.ReadUInt(source);

            int i = 0;

            do
            {
                // Read feature type.
                //
                currentFeatureType = (TDSFedAuthInfoId)source.ReadByte();

                // Ensure we're not looking at the terminator.
                //
                switch (currentFeatureType)
                {
                case TDSFedAuthInfoId.STSURL:
                {
                    // Create an STSURL option.
                    //
                    infoDataLength = TDSUtilities.ReadUInt(source);
                    infoDataOffset = TDSUtilities.ReadUInt(source);
                    Options.Add(i++, new TDSFedAuthInfoOptionSTSURL(infoDataLength));
                    break;
                }

                case TDSFedAuthInfoId.SPN:
                {
                    // Create SPN option.
                    //
                    infoDataLength = TDSUtilities.ReadUInt(source);
                    infoDataOffset = TDSUtilities.ReadUInt(source);
                    Options.Add(i++, new TDSFedAuthInfoOptionSPN(infoDataLength));
                    break;
                }

                default:
                {
                    // Create a new generic option
                    // Options.Add(new TDSFeatureExtAckGenericOption(currentFeatureType, source));
                    break;
                }
                }
            }while (--countOfIds > 0);

            foreach (TDSFedAuthInfoOption infoOption in Options.Values)
            {
                infoOption.Inflate(source);
            }

            // We're done inflating
            return(true);
        }
 /// <summary>
 /// Default public contructor
 /// </summary>
 public TDSFedAuthInfoOptionSTSURL()
 {
     _fedAuthInfoId = TDSFedAuthInfoId.STSURL;
 }
 /// <summary>
 /// Default public contructor
 /// </summary>
 public TDSFedAuthInfoOptionSPN()
 {
     _fedAuthInfoId = TDSFedAuthInfoId.SPN;
 }
 /// <summary>
 /// Default public constructor
 /// </summary>
 public TDSFedAuthInfoOptionSTSURL()
 {
     _fedAuthInfoId = TDSFedAuthInfoId.STSURL;
 }
 /// <summary>
 /// Default public contructor
 /// </summary>
 public TDSFedAuthInfoOptionSPN()
 {
     _fedAuthInfoId = TDSFedAuthInfoId.SPN;
 }