Example #1
0
        public IssuedTokensHeader(XmlReader xmlReader, MessageVersion version, SecurityStandardsManager standardsManager)
        {
            if (xmlReader == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("xmlReader");
            }
            if (standardsManager == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("standardsManager"));
            }
            this.standardsManager = standardsManager;
            XmlDictionaryReader reader = XmlDictionaryReader.CreateDictionaryReader(xmlReader);

            MessageHeader.GetHeaderAttributes(reader, version, out this.actor, out this.mustUnderstand, out this.relay, out this.isRefParam);
            reader.ReadStartElement(this.Name, this.Namespace);
            Collection <RequestSecurityTokenResponse> list = new Collection <RequestSecurityTokenResponse>();

            if (this.standardsManager.TrustDriver.IsAtRequestSecurityTokenResponseCollection(reader))
            {
                foreach (RequestSecurityTokenResponse response in this.standardsManager.TrustDriver.CreateRequestSecurityTokenResponseCollection(reader).RstrCollection)
                {
                    list.Add(response);
                }
            }
            else
            {
                RequestSecurityTokenResponse item = this.standardsManager.TrustDriver.CreateRequestSecurityTokenResponse(reader);
                list.Add(item);
            }
            this.tokenIssuances = new ReadOnlyCollection <RequestSecurityTokenResponse>(list);
            reader.ReadEndElement();
        }
        public DecryptedHeader(byte[] decryptedBuffer,
                               XmlAttributeHolder[] envelopeAttributes, XmlAttributeHolder[] headerAttributes,
                               MessageVersion version, SignatureTargetIdManager idManager, XmlDictionaryReaderQuotas quotas)
        {
            if (quotas == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("quotas");
            }

            this.decryptedBuffer    = decryptedBuffer;
            this.version            = version;
            this.envelopeAttributes = envelopeAttributes;
            this.headerAttributes   = headerAttributes;
            this.quotas             = quotas;

            XmlDictionaryReader reader = CreateReader();

            reader.MoveToStartElement();

            this.name         = reader.LocalName;
            this.namespaceUri = reader.NamespaceURI;
            MessageHeader.GetHeaderAttributes(reader, version, out this.actor, out this.mustUnderstand, out this.relay, out this.isRefParam);
            this.id = idManager.ExtractId(reader);

            this.cachedReader = reader;
        }
        public void ReadFrom(XmlDictionaryReader reader, long maxBufferSize)
        {
            bool flag;

            reader.MoveToStartElement(ElementName, NamespaceUri);
            MessageHeader.GetHeaderAttributes(reader, this.version, out this.actor, out this.mustUnderstand, out this.relay, out flag);
            this.id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace);
            reader.ReadStartElement();
            this.encryptedData.ReadFrom(reader, maxBufferSize);
            reader.ReadEndElement();
        }