private MessageSecurityTokenVersion(System.ServiceModel.Security.SecurityVersion securityVersion, System.ServiceModel.Security.TrustVersion trustVersion, System.ServiceModel.Security.SecureConversationVersion secureConversationVersion, string toString, bool emitBspRequiredAttributes, params string[] supportedSpecs)
 {
     this.emitBspRequiredAttributes = emitBspRequiredAttributes;
     this.supportedSpecs = new ReadOnlyCollection<string>(supportedSpecs);
     this.toString = toString;
     this.securityVersion = securityVersion;
     this.trustVersion = trustVersion;
     this.secureConversationVersion = secureConversationVersion;
 }
Esempio n. 2
0
 private MessageSecurityTokenVersion(System.ServiceModel.Security.SecurityVersion securityVersion, System.ServiceModel.Security.TrustVersion trustVersion, System.ServiceModel.Security.SecureConversationVersion secureConversationVersion, string toString, bool emitBspRequiredAttributes, params string[] supportedSpecs)
 {
     this.emitBspRequiredAttributes = emitBspRequiredAttributes;
     this.supportedSpecs            = new ReadOnlyCollection <string>(supportedSpecs);
     this.toString                  = toString;
     this.securityVersion           = securityVersion;
     this.trustVersion              = trustVersion;
     this.secureConversationVersion = secureConversationVersion;
 }
Esempio n. 3
0
 public static MessageSecurityTokenVersion GetSecurityTokenVersion(System.ServiceModel.Security.SecurityVersion version, bool emitBspAttributes)
 {
     if (version == System.ServiceModel.Security.SecurityVersion.WSSecurity10)
     {
         if (!emitBspAttributes)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
         }
         return(WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005BasicSecurityProfile10);
     }
     if (version != System.ServiceModel.Security.SecurityVersion.WSSecurity11)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
     }
     if (emitBspAttributes)
     {
         return(WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005BasicSecurityProfile10);
     }
     return(WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005);
 }
 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);
     }
 }
Esempio n. 5
0
 protected System.IdentityModel.Selectors.SecurityTokenSerializer CreateSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion version)
 {
     return(default(System.IdentityModel.Selectors.SecurityTokenSerializer));
 }
 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 WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable <Type> knownTypes, int maximumKeyDerivationOffset, int maximumKeyDerivationLabelLength, int maximumKeyDerivationNonceLength) : this(securityVersion, TrustVersion.Default, SecureConversationVersion.Default, emitBspRequiredAttributes, samlSerializer, securityStateEncoder, knownTypes, maximumKeyDerivationOffset, maximumKeyDerivationLabelLength, maximumKeyDerivationNonceLength)
 {
 }
 public WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable <Type> knownTypes) : this(securityVersion, trustVersion, secureConversationVersion, emitBspRequiredAttributes, samlSerializer, securityStateEncoder, knownTypes, 0x40, 0x80, 0x80)
 {
 }
 public WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer) : this(securityVersion, emitBspRequiredAttributes, samlSerializer, null, null)
 {
 }
 public WSSecurityTokenSerializer(System.ServiceModel.Security.SecurityVersion securityVersion) : this(securityVersion, false)
 {
 }