Ejemplo n.º 1
0
 public DerivedKeyTokenEntry(WSSecureConversation parent, int maxKeyDerivationOffset, int maxKeyDerivationLabelLength, int maxKeyDerivationNonceLength)
 {
     _parent = parent ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parent));
     _maxKeyDerivationOffset      = maxKeyDerivationOffset;
     _maxKeyDerivationLabelLength = maxKeyDerivationLabelLength;
     _maxKeyDerivationNonceLength = maxKeyDerivationNonceLength;
 }
Ejemplo n.º 2
0
 public DerivedKeyTokenEntry(WSSecureConversation parent)
 {
     if (parent == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");
     }
     this.parent = parent;
 }
 public DerivedKeyTokenEntry(WSSecureConversation parent, int maxKeyDerivationOffset, int maxKeyDerivationLabelLength, int maxKeyDerivationNonceLength)
 {
     if (parent == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");
     }
     this.parent = parent;
     this.maxKeyDerivationOffset = maxKeyDerivationOffset;
     this.maxKeyDerivationLabelLength = maxKeyDerivationLabelLength;
     this.maxKeyDerivationNonceLength = maxKeyDerivationNonceLength;
 }
Ejemplo n.º 4
0
 public DerivedKeyTokenEntry(WSSecureConversation parent, int maxKeyDerivationOffset, int maxKeyDerivationLabelLength, int maxKeyDerivationNonceLength)
 {
     if (parent == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");
     }
     this.parent = parent;
     this.maxKeyDerivationOffset      = maxKeyDerivationOffset;
     this.maxKeyDerivationLabelLength = maxKeyDerivationLabelLength;
     this.maxKeyDerivationNonceLength = maxKeyDerivationNonceLength;
 }
Ejemplo n.º 5
0
 public InitiatorSessionSymmetricMessageSecurityProtocol(SessionSymmetricMessageSecurityProtocolFactory factory, EndpointAddress target, Uri via) : base(factory, target, via)
 {
     this.thisLock = new object();
     if (!factory.ActAsInitiator)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("ProtocolMustBeInitiator", new object[] { "InitiatorSessionSymmetricMessageSecurityProtocol" })));
     }
     this.requireDerivedKeys = factory.SecurityTokenParameters.RequireDerivedKeys;
     if (this.requireDerivedKeys)
     {
         SecurityTokenSerializer securityTokenSerializer = this.Factory.StandardsManager.SecurityTokenSerializer;
         WSSecureConversation    secureConversation      = (securityTokenSerializer is WSSecurityTokenSerializer) ? ((WSSecurityTokenSerializer)securityTokenSerializer).SecureConversation : new WSSecurityTokenSerializer(this.Factory.MessageSecurityVersion.SecurityVersion).SecureConversation;
         this.sessionStandardsManager = new SecurityStandardsManager(factory.MessageSecurityVersion, new DerivedKeyCachingSecurityTokenSerializer(2, true, secureConversation, securityTokenSerializer));
     }
 }
Ejemplo n.º 6
0
 public AcceptorSessionSymmetricMessageSecurityProtocol(SessionSymmetricMessageSecurityProtocolFactory factory, EndpointAddress target) : base(factory, target, null)
 {
     this.thisLock = new object();
     if (factory.ActAsInitiator)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ProtocolMustBeRecipient", new object[] { base.GetType().ToString() })));
     }
     this.requireDerivedKeys = factory.SecurityTokenParameters.RequireDerivedKeys;
     if (this.requireDerivedKeys)
     {
         SecurityTokenSerializer securityTokenSerializer = this.Factory.StandardsManager.SecurityTokenSerializer;
         WSSecureConversation    secureConversation      = (securityTokenSerializer is WSSecurityTokenSerializer) ? ((WSSecurityTokenSerializer)securityTokenSerializer).SecureConversation : new WSSecurityTokenSerializer(this.Factory.MessageSecurityVersion.SecurityVersion).SecureConversation;
         this.sessionStandardsManager = new SecurityStandardsManager(factory.MessageSecurityVersion, new DerivedKeyCachingSecurityTokenSerializer(2, false, secureConversation, securityTokenSerializer));
     }
 }
 public AcceptorSessionSymmetricMessageSecurityProtocol(SessionSymmetricMessageSecurityProtocolFactory factory,
                                                        EndpointAddress target)
     : base(factory, target, null)
 {
     if (factory.ActAsInitiator == true)
     {
         Fx.Assert("This protocol can only be used at the recipient.");
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ProtocolMustBeRecipient, this.GetType().ToString())));
     }
     this.requireDerivedKeys = factory.SecurityTokenParameters.RequireDerivedKeys;
     if (requireDerivedKeys)
     {
         SecurityTokenSerializer innerTokenSerializer = this.Factory.StandardsManager.SecurityTokenSerializer;
         WSSecureConversation    secureConversation   = (innerTokenSerializer is WSSecurityTokenSerializer) ? ((WSSecurityTokenSerializer)innerTokenSerializer).SecureConversation : new WSSecurityTokenSerializer(this.Factory.MessageSecurityVersion.SecurityVersion).SecureConversation;
         this.sessionStandardsManager = new SecurityStandardsManager(factory.MessageSecurityVersion, new DerivedKeyCachingSecurityTokenSerializer(2, false, secureConversation, innerTokenSerializer));
     }
 }
 public InitiatorSessionSymmetricMessageSecurityProtocol(SessionSymmetricMessageSecurityProtocolFactory factory,
                                                         EndpointAddress target, Uri via)
     : base(factory, target, via)
 {
     if (factory.ActAsInitiator != true)
     {
         Fx.Assert("This protocol can only be used at the initiator.");
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.ProtocolMustBeInitiator, "InitiatorSessionSymmetricMessageSecurityProtocol")));
     }
     this.requireDerivedKeys = factory.SecurityTokenParameters.RequireDerivedKeys;
     if (requireDerivedKeys)
     {
         SecurityTokenSerializer innerTokenSerializer = this.Factory.StandardsManager.SecurityTokenSerializer;
         WSSecureConversation    secureConversation   = (innerTokenSerializer is WSSecurityTokenSerializer) ? ((WSSecurityTokenSerializer)innerTokenSerializer).SecureConversation : new WSSecurityTokenSerializer(this.Factory.MessageSecurityVersion.SecurityVersion).SecureConversation;
         this.sessionStandardsManager = new SecurityStandardsManager(factory.MessageSecurityVersion, new DerivedKeyCachingSecurityTokenSerializer(2, true, secureConversation, innerTokenSerializer));
     }
 }
 internal DerivedKeyCachingSecurityTokenSerializer(int cacheSize, bool isInitiator, WSSecureConversation secureConversation, SecurityTokenSerializer innerTokenSerializer)
 {
     if (innerTokenSerializer == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerTokenSerializer");
     }
     if (secureConversation == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("secureConversation");
     }
     if (cacheSize <= 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("cacheSize", System.ServiceModel.SR.GetString("ValueMustBeGreaterThanZero")));
     }
     this.cachedTokens = new DerivedKeySecurityTokenCache[cacheSize];
     this.isInitiator = isInitiator;
     this.secureConversation = secureConversation;
     this.innerTokenSerializer = innerTokenSerializer;
     this.thisLock = new object();
 }
 internal DerivedKeyCachingSecurityTokenSerializer(int cacheSize, bool isInitiator, WSSecureConversation secureConversation, SecurityTokenSerializer innerTokenSerializer)
 {
     if (innerTokenSerializer == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerTokenSerializer");
     }
     if (secureConversation == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("secureConversation");
     }
     if (cacheSize <= 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("cacheSize", System.ServiceModel.SR.GetString("ValueMustBeGreaterThanZero")));
     }
     this.cachedTokens         = new DerivedKeySecurityTokenCache[cacheSize];
     this.isInitiator          = isInitiator;
     this.secureConversation   = secureConversation;
     this.innerTokenSerializer = innerTokenSerializer;
     this.thisLock             = new object();
 }
Ejemplo n.º 11
0
 public SecurityContextTokenEntry(WSSecureConversation parent, SecurityStateEncoder securityStateEncoder, IList <Type> knownClaimTypes)
 {
     Parent = parent;
 }
        public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes,
            int maximumKeyDerivationOffset, int maximumKeyDerivationLabelLength, int maximumKeyDerivationNonceLength)
        {
            if (securityVersion == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("securityVersion"));

            if (maximumKeyDerivationOffset < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationOffset", SR.GetString(SR.ValueMustBeNonNegative)));
            }
            if (maximumKeyDerivationLabelLength < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationLabelLength", SR.GetString(SR.ValueMustBeNonNegative)));
            }
            if (maximumKeyDerivationNonceLength <= 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationNonceLength", SR.GetString(SR.ValueMustBeGreaterThanZero)));
            }

            this.securityVersion = securityVersion;
            this.emitBspRequiredAttributes = emitBspRequiredAttributes;
            this.maximumKeyDerivationOffset = maximumKeyDerivationOffset;
            this.maximumKeyDerivationNonceLength = maximumKeyDerivationNonceLength;
            this.maximumKeyDerivationLabelLength = maximumKeyDerivationLabelLength;

            this.serializerEntries = new List<SerializerEntries>();

            if (secureConversationVersion == SecureConversationVersion.WSSecureConversationFeb2005)
            {
                this.secureConversation = new WSSecureConversationFeb2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
            }
            else if (secureConversationVersion == SecureConversationVersion.WSSecureConversation13)
            {
                this.secureConversation = new WSSecureConversationDec2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
            }

            if (securityVersion == SecurityVersion.WSSecurity10)
            {
                this.serializerEntries.Add(new WSSecurityJan2004(this, samlSerializer));
            }
            else if (securityVersion == SecurityVersion.WSSecurity11)
            {
                this.serializerEntries.Add(new WSSecurityXXX2005(this, samlSerializer));
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("securityVersion", SR.GetString(SR.MessageSecurityVersionOutOfRange)));
            }
            this.serializerEntries.Add(this.secureConversation);
            IdentityModel.TrustDictionary trustDictionary;
            if (trustVersion == TrustVersion.WSTrustFeb2005)
            {
                this.serializerEntries.Add(new WSTrustFeb2005(this));
                trustDictionary = new IdentityModel.TrustFeb2005Dictionary(new CollectionDictionary(DXD.TrustDec2005Dictionary.Feb2005DictionaryStrings));
            }
            else if (trustVersion == TrustVersion.WSTrust13)
            {
                this.serializerEntries.Add(new WSTrustDec2005(this));
                trustDictionary = new IdentityModel.TrustDec2005Dictionary(new CollectionDictionary(DXD.TrustDec2005Dictionary.Dec2005DictionaryString));
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
            }

            this.tokenEntries = new List<TokenEntry>();

            for (int i = 0; i < this.serializerEntries.Count; ++i)
            {
                SerializerEntries serializerEntry = this.serializerEntries[i];
                serializerEntry.PopulateTokenEntries(this.tokenEntries);
            }

            IdentityModel.DictionaryManager dictionaryManager = new IdentityModel.DictionaryManager(ServiceModelDictionary.CurrentVersion);
            dictionaryManager.SecureConversationDec2005Dictionary = new IdentityModel.SecureConversationDec2005Dictionary(new CollectionDictionary(DXD.SecureConversationDec2005Dictionary.SecureConversationDictionaryStrings));
            dictionaryManager.SecurityAlgorithmDec2005Dictionary = new IdentityModel.SecurityAlgorithmDec2005Dictionary(new CollectionDictionary(DXD.SecurityAlgorithmDec2005Dictionary.SecurityAlgorithmDictionaryStrings));

            this.keyInfoSerializer = new WSKeyInfoSerializer(this.emitBspRequiredAttributes, dictionaryManager, trustDictionary, this, securityVersion, secureConversationVersion);
        }
 public DerivedKeyTokenEntry( WSSecureConversation parent )
 {
     if ( parent == null )
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "parent" );
     }
     this.parent = parent;
 }
 public SctStrEntry( WSSecureConversation parent )
 {
     this.parent = parent;
 }
 public WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable <Type> knownTypes, int maximumKeyDerivationOffset, int maximumKeyDerivationLabelLength, int maximumKeyDerivationNonceLength)
 {
     if (securityVersion == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("securityVersion"));
     }
     if (maximumKeyDerivationOffset < 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationOffset", System.ServiceModel.SR.GetString("ValueMustBeNonNegative")));
     }
     if (maximumKeyDerivationLabelLength < 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationLabelLength", System.ServiceModel.SR.GetString("ValueMustBeNonNegative")));
     }
     if (maximumKeyDerivationNonceLength <= 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationNonceLength", System.ServiceModel.SR.GetString("ValueMustBeGreaterThanZero")));
     }
     this.securityVersion                 = securityVersion;
     this.emitBspRequiredAttributes       = emitBspRequiredAttributes;
     this.maximumKeyDerivationOffset      = maximumKeyDerivationOffset;
     this.maximumKeyDerivationNonceLength = maximumKeyDerivationNonceLength;
     this.maximumKeyDerivationLabelLength = maximumKeyDerivationLabelLength;
     this.serializerEntries               = new List <SerializerEntries>();
     if (secureConversationVersion == SecureConversationVersion.WSSecureConversationFeb2005)
     {
         this.secureConversation = new WSSecureConversationFeb2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
     }
     else
     {
         if (secureConversationVersion != SecureConversationVersion.WSSecureConversation13)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
         }
         this.secureConversation = new WSSecureConversationDec2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
     }
     this.serializerEntries.Add(new XmlDsigSep2000(this));
     this.serializerEntries.Add(new XmlEncApr2001(this));
     if (securityVersion == System.ServiceModel.Security.SecurityVersion.WSSecurity10)
     {
         this.serializerEntries.Add(new WSSecurityJan2004(this, samlSerializer));
     }
     else
     {
         if (securityVersion != System.ServiceModel.Security.SecurityVersion.WSSecurity11)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("securityVersion", System.ServiceModel.SR.GetString("MessageSecurityVersionOutOfRange")));
         }
         this.serializerEntries.Add(new WSSecurityXXX2005(this, samlSerializer));
     }
     this.serializerEntries.Add(this.secureConversation);
     if (trustVersion == TrustVersion.WSTrustFeb2005)
     {
         this.serializerEntries.Add(new WSTrustFeb2005(this));
     }
     else
     {
         if (trustVersion != TrustVersion.WSTrust13)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
         }
         this.serializerEntries.Add(new WSTrustDec2005(this));
     }
     this.tokenEntries               = new List <TokenEntry>();
     this.keyIdentifierEntries       = new List <KeyIdentifierEntry>();
     this.keyIdentifierClauseEntries = new List <KeyIdentifierClauseEntry>();
     for (int i = 0; i < this.serializerEntries.Count; i++)
     {
         SerializerEntries entries = this.serializerEntries[i];
         entries.PopulateTokenEntries(this.tokenEntries);
         entries.PopulateKeyIdentifierEntries(this.keyIdentifierEntries);
         entries.PopulateKeyIdentifierClauseEntries(this.keyIdentifierClauseEntries);
     }
 }
 public SecurityContextTokenEntry( WSSecureConversation parent )
 {
     this.parent = parent;
 }
Ejemplo n.º 17
0
        public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable <Type> knownTypes,
                                         int maximumKeyDerivationOffset, int maximumKeyDerivationLabelLength, int maximumKeyDerivationNonceLength)
        {
            if (securityVersion == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("securityVersion"));
            }

            if (maximumKeyDerivationOffset < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationOffset", SRServiceModel.ValueMustBeNonNegative));
            }
            if (maximumKeyDerivationLabelLength < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationLabelLength", SRServiceModel.ValueMustBeNonNegative));
            }
            if (maximumKeyDerivationNonceLength <= 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationNonceLength", SRServiceModel.ValueMustBeGreaterThanZero));
            }

            _securityVersion                 = securityVersion;
            _emitBspRequiredAttributes       = emitBspRequiredAttributes;
            _maximumKeyDerivationOffset      = maximumKeyDerivationOffset;
            _maximumKeyDerivationNonceLength = maximumKeyDerivationNonceLength;
            _maximumKeyDerivationLabelLength = maximumKeyDerivationLabelLength;

            _serializerEntries = new List <SerializerEntries>();

            if (secureConversationVersion == SecureConversationVersion.WSSecureConversationFeb2005)
            {
                _secureConversation = new WSSecureConversationFeb2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
            }
            else if (secureConversationVersion == SecureConversationVersion.WSSecureConversation13)
            {
                _secureConversation = new WSSecureConversationDec2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
            }

            if (securityVersion == SecurityVersion.WSSecurity10)
            {
                _serializerEntries.Add(new WSSecurityJan2004(this, samlSerializer));
            }
            else if (securityVersion == SecurityVersion.WSSecurity11)
            {
                _serializerEntries.Add(new WSSecurityXXX2005(this, samlSerializer));
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("securityVersion", SRServiceModel.MessageSecurityVersionOutOfRange));
            }
            _serializerEntries.Add(_secureConversation);
            IdentityModel.TrustDictionary trustDictionary;
            if (trustVersion == TrustVersion.WSTrustFeb2005)
            {
                _serializerEntries.Add(new WSTrustFeb2005(this));
                trustDictionary = new IdentityModel.TrustFeb2005Dictionary(new CollectionDictionary(DXD.TrustDec2005Dictionary.Feb2005DictionaryStrings));
            }
            else if (trustVersion == TrustVersion.WSTrust13)
            {
                _serializerEntries.Add(new WSTrustDec2005(this));
                trustDictionary = new IdentityModel.TrustDec2005Dictionary(new CollectionDictionary(DXD.TrustDec2005Dictionary.Dec2005DictionaryString));
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
            }

            _tokenEntries = new List <TokenEntry>();

            for (int i = 0; i < _serializerEntries.Count; ++i)
            {
                SerializerEntries serializerEntry = _serializerEntries[i];
                serializerEntry.PopulateTokenEntries(_tokenEntries);
            }

            IdentityModel.DictionaryManager dictionaryManager = new IdentityModel.DictionaryManager(ServiceModelDictionary.CurrentVersion);
            dictionaryManager.SecureConversationDec2005Dictionary = new IdentityModel.SecureConversationDec2005Dictionary(new CollectionDictionary(DXD.SecureConversationDec2005Dictionary.SecureConversationDictionaryStrings));
            dictionaryManager.SecurityAlgorithmDec2005Dictionary  = new IdentityModel.SecurityAlgorithmDec2005Dictionary(new CollectionDictionary(DXD.SecurityAlgorithmDec2005Dictionary.SecurityAlgorithmDictionaryStrings));

            _keyInfoSerializer = new WSKeyInfoSerializer(_emitBspRequiredAttributes, dictionaryManager, trustDictionary, this, securityVersion, secureConversationVersion);
        }
 public SecurityContextTokenEntry(WSSecureConversation parent, SecurityStateEncoder securityStateEncoder, IList<Type> knownClaimTypes)
 {
     this.parent = parent;
     this.cookieSerializer = new SecurityContextCookieSerializer(securityStateEncoder, knownClaimTypes);
 }
Ejemplo n.º 19
0
 public SctStrEntry(WSSecureConversation parent)
 {
     this.parent = parent;
 }
 public DerivedKeyTokenEntry(WSSecureConversation parent)
 {
     _parent = parent ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parent));
 }
Ejemplo n.º 21
0
 public SecurityContextTokenEntry(WSSecureConversation parent)
 {
     this.parent = parent;
 }
 public WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes, int maximumKeyDerivationOffset, int maximumKeyDerivationLabelLength, int maximumKeyDerivationNonceLength)
 {
     if (securityVersion == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("securityVersion"));
     }
     if (maximumKeyDerivationOffset < 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationOffset", System.ServiceModel.SR.GetString("ValueMustBeNonNegative")));
     }
     if (maximumKeyDerivationLabelLength < 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationLabelLength", System.ServiceModel.SR.GetString("ValueMustBeNonNegative")));
     }
     if (maximumKeyDerivationNonceLength <= 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maximumKeyDerivationNonceLength", System.ServiceModel.SR.GetString("ValueMustBeGreaterThanZero")));
     }
     this.securityVersion = securityVersion;
     this.emitBspRequiredAttributes = emitBspRequiredAttributes;
     this.maximumKeyDerivationOffset = maximumKeyDerivationOffset;
     this.maximumKeyDerivationNonceLength = maximumKeyDerivationNonceLength;
     this.maximumKeyDerivationLabelLength = maximumKeyDerivationLabelLength;
     this.serializerEntries = new List<SerializerEntries>();
     if (secureConversationVersion == SecureConversationVersion.WSSecureConversationFeb2005)
     {
         this.secureConversation = new WSSecureConversationFeb2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
     }
     else
     {
         if (secureConversationVersion != SecureConversationVersion.WSSecureConversation13)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
         }
         this.secureConversation = new WSSecureConversationDec2005(this, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength);
     }
     this.serializerEntries.Add(new XmlDsigSep2000(this));
     this.serializerEntries.Add(new XmlEncApr2001(this));
     if (securityVersion == System.ServiceModel.Security.SecurityVersion.WSSecurity10)
     {
         this.serializerEntries.Add(new WSSecurityJan2004(this, samlSerializer));
     }
     else
     {
         if (securityVersion != System.ServiceModel.Security.SecurityVersion.WSSecurity11)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("securityVersion", System.ServiceModel.SR.GetString("MessageSecurityVersionOutOfRange")));
         }
         this.serializerEntries.Add(new WSSecurityXXX2005(this, samlSerializer));
     }
     this.serializerEntries.Add(this.secureConversation);
     if (trustVersion == TrustVersion.WSTrustFeb2005)
     {
         this.serializerEntries.Add(new WSTrustFeb2005(this));
     }
     else
     {
         if (trustVersion != TrustVersion.WSTrust13)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
         }
         this.serializerEntries.Add(new WSTrustDec2005(this));
     }
     this.tokenEntries = new List<TokenEntry>();
     this.keyIdentifierEntries = new List<KeyIdentifierEntry>();
     this.keyIdentifierClauseEntries = new List<KeyIdentifierClauseEntry>();
     for (int i = 0; i < this.serializerEntries.Count; i++)
     {
         SerializerEntries entries = this.serializerEntries[i];
         entries.PopulateTokenEntries(this.tokenEntries);
         entries.PopulateKeyIdentifierEntries(this.keyIdentifierEntries);
         entries.PopulateKeyIdentifierClauseEntries(this.keyIdentifierClauseEntries);
     }
 }
Ejemplo n.º 23
0
 public SecurityContextTokenEntry(WSSecureConversation parent, SecurityStateEncoder securityStateEncoder, IList <Type> knownClaimTypes)
 {
     this.parent           = parent;
     this.cookieSerializer = new SecurityContextCookieSerializer(securityStateEncoder, knownClaimTypes);
 }