< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.WSSecureConversation
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WSSecureConversation.cs
Line coverage
34%
Covered lines: 77
Uncovered lines: 147
Coverable lines: 224
Total lines: 538
Line coverage: 34.3%
Branch coverage
24%
Covered branches: 30
Total branches: 124
Branch coverage: 24.1%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WSSecureConversation.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Xml;
 7using CoreWCF.IdentityModel;
 8using CoreWCF.IdentityModel.Selectors;
 9using CoreWCF.IdentityModel.Tokens;
 10using CoreWCF.Runtime;
 11using CoreWCF.Security.Tokens;
 12using TokenEntry = CoreWCF.Security.WSSecurityTokenSerializer.TokenEntry;
 13
 14namespace CoreWCF.Security
 15{
 16    internal abstract class WSSecureConversation : WSSecurityTokenSerializer.SerializerEntries
 17    {
 18        private readonly DerivedKeyTokenEntry _derivedKeyEntry;
 19
 13220        protected WSSecureConversation(WSSecurityTokenSerializer tokenSerializer, int maxKeyDerivationOffset, int maxKey
 21        {
 13222            WSSecurityTokenSerializer = tokenSerializer ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentN
 13223            _derivedKeyEntry = new DerivedKeyTokenEntry(this, maxKeyDerivationOffset, maxKeyDerivationLabelLength, maxKe
 13224        }
 25
 26        public abstract SecureConversationDictionary SerializerDictionary
 27        {
 28            get;
 29        }
 30
 031        public WSSecurityTokenSerializer WSSecurityTokenSerializer { get; }
 32
 33        public override void PopulateTokenEntries(IList<TokenEntry> tokenEntryList)
 34        {
 13235            if (tokenEntryList == null)
 36            {
 037                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenEntryList));
 38            }
 13239            tokenEntryList.Add(_derivedKeyEntry);
 13240        }
 41
 42        public virtual bool IsAtDerivedKeyToken(XmlDictionaryReader reader)
 43        {
 044            return _derivedKeyEntry.CanReadTokenCore(reader);
 45        }
 46
 47        public virtual void ReadDerivedKeyTokenParameters(XmlDictionaryReader reader, SecurityTokenResolver tokenResolve
 48        {
 049            _derivedKeyEntry.ReadDerivedKeyTokenParameters(reader, tokenResolver, out id, out derivationAlgorithm, out l
 050                out length, out nonce, out offset, out generation, out tokenToDeriveIdentifier, out tokenToDerive);
 051        }
 52
 53        public virtual SecurityToken CreateDerivedKeyToken(string id, string derivationAlgorithm, string label, int leng
 54        {
 055            return _derivedKeyEntry.CreateDerivedKeyToken(id, derivationAlgorithm, label, length, nonce, offset, generat
 056                tokenToDeriveIdentifier, tokenToDerive);
 57        }
 58
 059        public virtual string DerivationAlgorithm => SecurityAlgorithms.Psha1KeyDerivation;
 60
 61        protected class DerivedKeyTokenEntry : WSSecurityTokenSerializer.TokenEntry
 62        {
 63            public const string DefaultLabel = "WS-SecureConversation";
 64            private readonly WSSecureConversation _parent;
 65            private readonly int _maxKeyDerivationOffset;
 66            private readonly int _maxKeyDerivationLabelLength;
 67            private readonly int _maxKeyDerivationNonceLength;
 68
 13269            public DerivedKeyTokenEntry(WSSecureConversation parent, int maxKeyDerivationOffset, int maxKeyDerivationLab
 70            {
 13271                _parent = parent ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parent));
 13272                _maxKeyDerivationOffset = maxKeyDerivationOffset;
 13273                _maxKeyDerivationLabelLength = maxKeyDerivationLabelLength;
 13274                _maxKeyDerivationNonceLength = maxKeyDerivationNonceLength;
 13275            }
 76
 3077            protected override XmlDictionaryString LocalName => _parent.SerializerDictionary.DerivedKeyToken;
 3078            protected override XmlDictionaryString NamespaceUri => _parent.SerializerDictionary.Namespace;
 1079            protected override Type[] GetTokenTypesCore() { return new Type[] { typeof(DerivedKeySecurityToken) }; }
 080            public override string TokenTypeUri => _parent.SerializerDictionary.DerivedKeyTokenType.Value;
 081            protected override string ValueTypeUri => null;
 82
 83            public override SecurityKeyIdentifierClause CreateKeyIdentifierClauseFromTokenXmlCore(XmlElement issuedToken
 84                SecurityTokenReferenceStyle tokenReferenceStyle)
 85            {
 086                TokenReferenceStyleHelper.Validate(tokenReferenceStyle);
 87
 88                switch (tokenReferenceStyle)
 89                {
 90                    case SecurityTokenReferenceStyle.Internal:
 091                        return CreateDirectReference(issuedTokenXml, UtilityStrings.IdAttribute, UtilityStrings.Namespac
 92                    case SecurityTokenReferenceStyle.External:
 93                        // DerivedKeys aren't referred to externally
 094                        return null;
 95                    default:
 096                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof
 97                }
 98            }
 99
 100            // xml format
 101            //<DerivedKeyToken wsu:Id="..." wsse:Algorithm="..."> id required, alg optional (curr disallowed)
 102            //  <SecurityTokenReference>...</SecurityTokenReference> - required
 103            //  <Properties>...</Properties> - disallowed (optional in spec, but we disallow it)
 104            // choice begin - (schema requires a choice - we allow neither on read - we always write one)
 105            //  <Generation>...</Generation> - optional
 106            //  <Offset>...</Offset> - optional
 107            // choice end
 108            //  <Length>...</Length> - optional - default 32 on read (default specified in spec, not in schema - we alwa
 109            //  <Label>...</Label> - optional
 110            //  <Nonce>...</Nonce> - required (optional in spec, but we require it)
 111            //</DerivedKeyToken>
 112            public virtual void ReadDerivedKeyTokenParameters(XmlDictionaryReader reader, SecurityTokenResolver tokenRes
 113            {
 0114                if (tokenResolver == null)
 115                {
 0116                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenResolver));
 117                }
 118
 0119                id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace);
 120
 0121                derivationAlgorithm = reader.GetAttribute(XD.XmlSignatureDictionary.Algorithm, null);
 0122                if (derivationAlgorithm == null)
 123                {
 0124                    derivationAlgorithm = _parent.DerivationAlgorithm;
 125                }
 126
 0127                reader.ReadStartElement();
 128
 0129                tokenToDeriveIdentifier = null;
 0130                tokenToDerive = null;
 131
 0132                if (reader.IsStartElement(XD.SecurityJan2004Dictionary.SecurityTokenReference, XD.SecurityJan2004Diction
 133                {
 0134                    tokenToDeriveIdentifier = _parent.WSSecurityTokenSerializer.ReadKeyIdentifierClause(reader);
 0135                    tokenResolver.TryResolveToken(tokenToDeriveIdentifier, out tokenToDerive);
 136                }
 137                else
 138                {
 0139                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.DerivedKeyTo
 140                }
 141
 142                // no support for properties
 143
 0144                generation = -1;
 0145                if (reader.IsStartElement(_parent.SerializerDictionary.Generation, _parent.SerializerDictionary.Namespac
 146                {
 0147                    reader.ReadStartElement();
 0148                    generation = reader.ReadContentAsInt();
 0149                    reader.ReadEndElement();
 0150                    if (generation < 0)
 151                    {
 0152                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.DerivedK
 153                    }
 154                }
 155
 0156                offset = -1;
 0157                if (reader.IsStartElement(_parent.SerializerDictionary.Offset, _parent.SerializerDictionary.Namespace))
 158                {
 0159                    reader.ReadStartElement();
 0160                    offset = reader.ReadContentAsInt();
 0161                    reader.ReadEndElement();
 0162                    if (offset < 0)
 163                    {
 0164                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.DerivedK
 165                    }
 166                }
 167
 0168                length = DerivedKeySecurityToken.DefaultDerivedKeyLength;
 0169                if (reader.IsStartElement(_parent.SerializerDictionary.Length, _parent.SerializerDictionary.Namespace))
 170                {
 0171                    reader.ReadStartElement();
 0172                    length = reader.ReadContentAsInt();
 0173                    reader.ReadEndElement();
 174                }
 175
 0176                if ((offset == -1) && (generation == -1))
 177                {
 0178                    offset = 0;
 179                }
 180
 181                // verify that the offset is not larger than the max allowed
 0182                DerivedKeySecurityToken.EnsureAcceptableOffset(offset, generation, length, _maxKeyDerivationOffset);
 183
 0184                label = null;
 0185                if (reader.IsStartElement(_parent.SerializerDictionary.Label, _parent.SerializerDictionary.Namespace))
 186                {
 0187                    reader.ReadStartElement();
 0188                    label = reader.ReadString();
 0189                    reader.ReadEndElement();
 190                }
 0191                if (label != null && label.Length > _maxKeyDerivationLabelLength)
 192                {
 0193                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SR.Format(S
 194                }
 195
 0196                reader.ReadStartElement(_parent.SerializerDictionary.Nonce, _parent.SerializerDictionary.Namespace);
 0197                nonce = reader.ReadContentAsBase64();
 0198                reader.ReadEndElement();
 199
 0200                if (nonce != null && nonce.Length > _maxKeyDerivationNonceLength)
 201                {
 0202                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SR.Format(S
 203                }
 204
 0205                reader.ReadEndElement();
 0206            }
 207
 208            public virtual SecurityToken CreateDerivedKeyToken(string id, string derivationAlgorithm, string label, int 
 209            {
 0210                if (tokenToDerive == null)
 211                {
 0212                    return new DerivedKeySecurityTokenStub(generation, offset, length,
 0213                        label, nonce, tokenToDeriveIdentifier, derivationAlgorithm, id);
 214                }
 215                else
 216                {
 0217                    return new DerivedKeySecurityToken(generation, offset, length,
 0218                        label, nonce, tokenToDerive, tokenToDeriveIdentifier, derivationAlgorithm, id);
 219                }
 220            }
 221
 222            public override SecurityToken ReadTokenCore(XmlDictionaryReader reader, SecurityTokenResolver tokenResolver)
 223            {
 0224                ReadDerivedKeyTokenParameters(reader, tokenResolver, out string id, out string derivationAlgorithm, out 
 0225                    out byte[] nonce, out int offset, out int generation, out SecurityKeyIdentifierClause tokenToDeriveI
 226
 0227                return CreateDerivedKeyToken(id, derivationAlgorithm, label, length, nonce, offset, generation,
 0228                    tokenToDeriveIdentifier, tokenToDerive);
 229            }
 230
 231            public override void WriteTokenCore(XmlDictionaryWriter writer, SecurityToken token)
 232            {
 0233                DerivedKeySecurityToken derivedKeyToken = token as DerivedKeySecurityToken;
 0234                string serializerPrefix = _parent.SerializerDictionary.Prefix.Value;
 235
 0236                writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.DerivedKeyToken, _parent.Seriali
 0237                if (derivedKeyToken.Id != null)
 238                {
 0239                    writer.WriteAttributeString(XD.UtilityDictionary.Prefix.Value, XD.UtilityDictionary.IdAttribute, XD.
 240                }
 0241                if (derivedKeyToken.KeyDerivationAlgorithm != _parent.DerivationAlgorithm)
 242                {
 0243                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.
 244                }
 0245                _parent.WSSecurityTokenSerializer.WriteKeyIdentifierClause(writer, derivedKeyToken.TokenToDeriveIdentifi
 246
 247                // Don't support Properties element
 0248                if (derivedKeyToken.Generation > 0 || derivedKeyToken.Offset > 0 || derivedKeyToken.Length != 32)
 249                {
 250                    // this means they're both specified (offset must be gen * length) - we'll write generation
 0251                    if (derivedKeyToken.Generation >= 0 && derivedKeyToken.Offset >= 0)
 252                    {
 0253                        writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Generation, _parent.Seri
 0254                        writer.WriteValue(derivedKeyToken.Generation);
 0255                        writer.WriteEndElement();
 256                    }
 0257                    else if (derivedKeyToken.Generation != -1)
 258                    {
 0259                        writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Generation, _parent.Seri
 0260                        writer.WriteValue(derivedKeyToken.Generation);
 0261                        writer.WriteEndElement();
 262                    }
 0263                    else if (derivedKeyToken.Offset != -1)
 264                    {
 0265                        writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Offset, _parent.Serializ
 0266                        writer.WriteValue(derivedKeyToken.Offset);
 0267                        writer.WriteEndElement();
 268                    }
 269
 0270                    if (derivedKeyToken.Length != 32)
 271                    {
 0272                        writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Length, _parent.Serializ
 0273                        writer.WriteValue(derivedKeyToken.Length);
 0274                        writer.WriteEndElement();
 275                    }
 276                }
 277
 0278                if (derivedKeyToken.Label != null)
 279                {
 0280                    writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Generation, _parent.Serializ
 0281                    writer.WriteString(derivedKeyToken.Label);
 0282                    writer.WriteEndElement();
 283                }
 0284                writer.WriteStartElement(serializerPrefix, _parent.SerializerDictionary.Nonce, _parent.SerializerDiction
 0285                writer.WriteBase64(derivedKeyToken.Nonce, 0, derivedKeyToken.Nonce.Length);
 0286                writer.WriteEndElement();
 0287                writer.WriteEndElement();
 0288            }
 289        }
 290
 291        protected abstract class SecurityContextTokenEntry : WSSecurityTokenSerializer.TokenEntry
 292        {
 293            private SecurityContextCookieSerializer _cookieSerializer;
 294
 132295            public SecurityContextTokenEntry(WSSecureConversation parent, SecurityStateEncoder securityStateEncoder, ILi
 296            {
 132297                Parent = parent;
 132298                _cookieSerializer = new SecurityContextCookieSerializer(securityStateEncoder, knownClaimTypes);
 132299            }
 300
 180301            protected WSSecureConversation Parent { get; }
 302
 30303            protected override XmlDictionaryString LocalName => Parent.SerializerDictionary.SecurityContextToken;
 30304            protected override XmlDictionaryString NamespaceUri => Parent.SerializerDictionary.Namespace;
 10305            protected override Type[] GetTokenTypesCore() { return new Type[] { typeof(SecurityContextSecurityToken) }; 
 0306            public override string TokenTypeUri => Parent.SerializerDictionary.SecurityContextTokenType.Value;
 20307            protected override string ValueTypeUri => null;
 308
 309            public override SecurityKeyIdentifierClause CreateKeyIdentifierClauseFromTokenXmlCore(XmlElement issuedToken
 310                SecurityTokenReferenceStyle tokenReferenceStyle)
 311            {
 0312                TokenReferenceStyleHelper.Validate(tokenReferenceStyle);
 313
 314                switch (tokenReferenceStyle)
 315                {
 316                    case SecurityTokenReferenceStyle.Internal:
 0317                        return CreateDirectReference(issuedTokenXml, UtilityStrings.IdAttribute, UtilityStrings.Namespac
 318                    case SecurityTokenReferenceStyle.External:
 0319                        UniqueId contextId = null;
 0320                        UniqueId generation = null;
 0321                        foreach (XmlNode node in issuedTokenXml.ChildNodes)
 322                        {
 0323                            if (node is XmlElement element)
 324                            {
 0325                                if (element.LocalName == Parent.SerializerDictionary.Identifier.Value && element.Namespa
 326                                {
 0327                                    contextId = XmlHelper.ReadTextElementAsUniqueId(element);
 328                                }
 0329                                else if (CanReadGeneration(element))
 330                                {
 0331                                    generation = ReadGeneration(element);
 332                                }
 333                            }
 334                        }
 0335                        return new SecurityContextKeyIdentifierClause(contextId, generation);
 336                    default:
 0337                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof
 338                }
 339            }
 340
 341            protected abstract bool CanReadGeneration(XmlDictionaryReader reader);
 342            protected abstract bool CanReadGeneration(XmlElement element);
 343            protected abstract UniqueId ReadGeneration(XmlDictionaryReader reader);
 344            protected abstract UniqueId ReadGeneration(XmlElement element);
 345
 346            private SecurityContextSecurityToken TryResolveSecurityContextToken(UniqueId contextId, UniqueId generation,
 347            {
 20348                SecurityContextSecurityToken cachedSct = null;
 20349                sctCache = null;
 20350                if (tokenResolver is ISecurityContextSecurityTokenCache)
 351                {
 0352                    sctCache = ((ISecurityContextSecurityTokenCache)tokenResolver);
 0353                    cachedSct = sctCache.GetContext(contextId, generation);
 354                }
 20355                else if (tokenResolver is AggregateSecurityHeaderTokenResolver)
 356                {
 357                    // We will see if we have a ISecurityContextSecurityTokenCache in the
 358                    // AggregateTokenResolver. We will hold the reference to the first sctCache
 359                    // we find.
 20360                    AggregateSecurityHeaderTokenResolver aggregateTokenResolve = tokenResolver as AggregateSecurityHeade
 40361                    for (int i = 0; i < aggregateTokenResolve.TokenResolvers.Count; ++i)
 362                    {
 20363                        if (!(aggregateTokenResolve.TokenResolvers[i] is ISecurityContextSecurityTokenCache oobTokenReso
 364                        {
 365                            continue;
 366                        }
 20367                        if (sctCache == null)
 368                        {
 20369                            sctCache = oobTokenResolver;
 370                        }
 20371                        cachedSct = oobTokenResolver.GetContext(contextId, generation);
 20372                        if (cachedSct != null)
 373                        {
 374                            break;
 375                        }
 376                    }
 377                }
 20378                if (cachedSct == null)
 379                {
 0380                    return null;
 381                }
 20382                else if (cachedSct.Id == id)
 383                {
 20384                    return cachedSct;
 385                }
 386                else
 387                {
 0388                    return new SecurityContextSecurityToken(cachedSct, id);
 389                }
 390            }
 391
 392            public override SecurityToken ReadTokenCore(XmlDictionaryReader reader, SecurityTokenResolver tokenResolver)
 393            {
 20394                UniqueId generation = null;
 20395                bool isCookieMode = false;
 396
 397                Fx.Assert(reader.NodeType == XmlNodeType.Element, "");
 398
 399                // check if there is an id
 20400                string id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace);
 401
 20402                SecurityContextSecurityToken sct = null;
 403
 404                // There needs to be at least a contextId in here.
 20405                reader.ReadFullStartElement();
 20406                reader.MoveToStartElement(Parent.SerializerDictionary.Identifier, Parent.SerializerDictionary.Namespace)
 20407                UniqueId contextId = reader.ReadElementContentAsUniqueId();
 20408                if (CanReadGeneration(reader))
 409                {
 0410                    generation = ReadGeneration(reader);
 411                }
 20412                if (reader.IsStartElement(Parent.SerializerDictionary.Cookie, XD.DotNetSecurityDictionary.Namespace))
 413                {
 0414                    isCookieMode = true;
 0415                    sct = TryResolveSecurityContextToken(contextId, generation, id, tokenResolver, out ISecurityContextS
 0416                    if (sct == null)
 417                    {
 0418                        byte[] encodedCookie = reader.ReadElementContentAsBase64();
 0419                        if (encodedCookie != null)
 420                        {
 0421                            sct = _cookieSerializer.CreateSecurityContextFromCookie(encodedCookie, contextId, generation
 0422                            if (sctCache != null)
 423                            {
 0424                                sctCache.AddContext(sct);
 425                            }
 426                        }
 427                    }
 428                    else
 429                    {
 0430                        reader.Skip();
 431                    }
 432                }
 20433                reader.ReadEndElement();
 434
 20435                if (contextId == null)
 436                {
 0437                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.
 438                }
 439
 20440                if (sct == null && !isCookieMode)
 441                {
 20442                    sct = TryResolveSecurityContextToken(contextId, generation, id, tokenResolver, out ISecurityContextS
 443                }
 20444                if (sct == null)
 445                {
 0446                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new Exception(SR.Format(SR.SecurityConte
 447                }
 20448                return sct;
 449            }
 450
 451            protected virtual void WriteGeneration(XmlDictionaryWriter writer, SecurityContextSecurityToken sct)
 452            {
 0453            }
 454
 455            public override void WriteTokenCore(XmlDictionaryWriter writer, SecurityToken token)
 456            {
 10457                SecurityContextSecurityToken sct = (token as SecurityContextSecurityToken);
 458
 459                // serialize the name and any wsu:Id attribute
 10460                writer.WriteStartElement(Parent.SerializerDictionary.Prefix.Value, Parent.SerializerDictionary.SecurityC
 10461                if (sct.Id != null)
 462                {
 10463                    writer.WriteAttributeString(XD.UtilityDictionary.Prefix.Value, XD.UtilityDictionary.IdAttribute, XD.
 464                }
 465
 466                // serialize the context id
 10467                writer.WriteStartElement(Parent.SerializerDictionary.Prefix.Value, Parent.SerializerDictionary.Identifie
 10468                XmlHelper.WriteStringAsUniqueId(writer, sct.ContextId);
 10469                writer.WriteEndElement();
 470
 10471                WriteGeneration(writer, sct);
 472
 473                // if cookie-mode, then it must have a cookie
 10474                if (sct.IsCookieMode)
 475                {
 0476                    if (sct.CookieBlob == null)
 477                    {
 0478                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format
 479                    }
 480
 481                    // if the token has a cookie, write it out
 0482                    writer.WriteStartElement(XD.DotNetSecurityDictionary.Prefix.Value, Parent.SerializerDictionary.Cooki
 0483                    writer.WriteBase64(sct.CookieBlob, 0, sct.CookieBlob.Length);
 0484                    writer.WriteEndElement();
 485                }
 486
 10487                writer.WriteEndElement();
 10488            }
 489        }
 490
 491        public abstract class Driver : SecureConversationDriver
 492        {
 131493            public Driver()
 494            {
 131495            }
 496
 497            protected abstract SecureConversationDictionary DriverDictionary
 498            {
 499                get;
 500            }
 501
 32502            public override XmlDictionaryString IssueAction => DriverDictionary.RequestSecurityContextIssuance;
 503
 10504            public override XmlDictionaryString IssueResponseAction => DriverDictionary.RequestSecurityContextIssuanceRe
 505
 0506            public override XmlDictionaryString RenewNeededFaultCode => DriverDictionary.RenewNeededFaultCode;
 507
 0508            public override XmlDictionaryString BadContextTokenFaultCode => DriverDictionary.BadContextTokenFaultCode;
 509
 510            public override UniqueId GetSecurityContextTokenId(XmlDictionaryReader reader)
 511            {
 20512                if (reader == null)
 513                {
 0514                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(reader));
 515                }
 516
 20517                reader.ReadStartElement(DriverDictionary.SecurityContextToken, DriverDictionary.Namespace);
 20518                UniqueId contextId = XmlHelper.ReadElementStringAsUniqueId(reader, DriverDictionary.Identifier, DriverDi
 20519                while (reader.IsStartElement())
 520                {
 0521                    reader.Skip();
 522                }
 20523                reader.ReadEndElement();
 20524                return contextId;
 525            }
 526
 527            public override bool IsAtSecurityContextToken(XmlDictionaryReader reader)
 528            {
 40529                if (reader == null)
 530                {
 0531                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(reader));
 532                }
 533
 40534                return reader.IsStartElement(DriverDictionary.SecurityContextToken, DriverDictionary.Namespace);
 535            }
 536        }
 537    }
 538}

Methods/Properties

.ctor(CoreWCF.Security.WSSecurityTokenSerializer,System.Int32,System.Int32,System.Int32)
WSSecurityTokenSerializer()
PopulateTokenEntries(System.Collections.Generic.IList`1<CoreWCF.Security.WSSecurityTokenSerializer/TokenEntry>)
IsAtDerivedKeyToken(System.Xml.XmlDictionaryReader)
ReadDerivedKeyTokenParameters(System.Xml.XmlDictionaryReader,CoreWCF.IdentityModel.Selectors.SecurityTokenResolver,System.String&,System.String&,System.String&,System.Int32&,System.Byte[]&,System.Int32&,System.Int32&,CoreWCF.IdentityModel.SecurityKeyIdentifierClause&,CoreWCF.IdentityModel.Tokens.SecurityToken&)
CreateDerivedKeyToken(System.String,System.String,System.String,System.Int32,System.Byte[],System.Int32,System.Int32,CoreWCF.IdentityModel.SecurityKeyIdentifierClause,CoreWCF.IdentityModel.Tokens.SecurityToken)
DerivationAlgorithm()
.ctor(CoreWCF.Security.WSSecureConversation,System.Int32,System.Int32,System.Int32)
LocalName()
NamespaceUri()
GetTokenTypesCore()
TokenTypeUri()
ValueTypeUri()
CreateKeyIdentifierClauseFromTokenXmlCore(System.Xml.XmlElement,CoreWCF.Security.Tokens.SecurityTokenReferenceStyle)
ReadDerivedKeyTokenParameters(System.Xml.XmlDictionaryReader,CoreWCF.IdentityModel.Selectors.SecurityTokenResolver,System.String&,System.String&,System.String&,System.Int32&,System.Byte[]&,System.Int32&,System.Int32&,CoreWCF.IdentityModel.SecurityKeyIdentifierClause&,CoreWCF.IdentityModel.Tokens.SecurityToken&)
CreateDerivedKeyToken(System.String,System.String,System.String,System.Int32,System.Byte[],System.Int32,System.Int32,CoreWCF.IdentityModel.SecurityKeyIdentifierClause,CoreWCF.IdentityModel.Tokens.SecurityToken)
ReadTokenCore(System.Xml.XmlDictionaryReader,CoreWCF.IdentityModel.Selectors.SecurityTokenResolver)
WriteTokenCore(System.Xml.XmlDictionaryWriter,CoreWCF.IdentityModel.Tokens.SecurityToken)
.ctor(CoreWCF.Security.WSSecureConversation,CoreWCF.Security.SecurityStateEncoder,System.Collections.Generic.IList`1<System.Type>)
Parent()
LocalName()
NamespaceUri()
GetTokenTypesCore()
TokenTypeUri()
ValueTypeUri()
CreateKeyIdentifierClauseFromTokenXmlCore(System.Xml.XmlElement,CoreWCF.Security.Tokens.SecurityTokenReferenceStyle)
TryResolveSecurityContextToken(System.Xml.UniqueId,System.Xml.UniqueId,System.String,CoreWCF.IdentityModel.Selectors.SecurityTokenResolver,CoreWCF.Security.Tokens.ISecurityContextSecurityTokenCache&)
ReadTokenCore(System.Xml.XmlDictionaryReader,CoreWCF.IdentityModel.Selectors.SecurityTokenResolver)
WriteGeneration(System.Xml.XmlDictionaryWriter,CoreWCF.Security.Tokens.SecurityContextSecurityToken)
WriteTokenCore(System.Xml.XmlDictionaryWriter,CoreWCF.IdentityModel.Tokens.SecurityToken)
.ctor()
IssueAction()
IssueResponseAction()
RenewNeededFaultCode()
BadContextTokenFaultCode()
GetSecurityContextTokenId(System.Xml.XmlDictionaryReader)
IsAtSecurityContextToken(System.Xml.XmlDictionaryReader)