Beispiel #1
0
        public void AddBasicSupportingToken(SecurityToken token, SecurityTokenParameters parameters)
        {
            if (token == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token));
            }

            if (parameters == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parameters));
            }

            ThrowIfProcessingStarted();
            SendSecurityHeaderElement tokenElement = new SendSecurityHeaderElement(token.Id, new TokenElement(token, StandardsManager))
            {
                MarkedForEncryption = true
            };

            ElementContainer.AddBasicSupportingToken(tokenElement);
            HasEncryptedTokens = true;
            HasSignedTokens    = true;
            AddParameters(ref _basicSupportingTokenParameters, parameters);
            if (_basicTokens == null)
            {
                _basicTokens = new List <SecurityToken>();
            }
            //  We maintain a list of the basic tokens for the SignThenEncrypt case as we will
            //  need this token to write STR entry on OnWriteHeaderContents.
            _basicTokens.Add(token);
        }
Beispiel #2
0
        public void AddBasicSupportingToken(SecurityToken token, SecurityTokenParameters parameters)
        {
            if (token == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token));
            }

            if (parameters == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parameters));
            }

            ThrowIfProcessingStarted();
            SendSecurityHeaderElement tokenElement = new SendSecurityHeaderElement(token.Id, new TokenElement(token, StandardsManager));

            tokenElement.MarkedForEncryption = true;
            ElementContainer.AddBasicSupportingToken(tokenElement);
            AddParameters(ref _basicSupportingTokenParameters, parameters);
        }