LaxTimestampLastModeSecurityHeaderElementInferenceEngine.cs 1.3 KB

123456789101112131415161718192021222324252627282930
  1. //----------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.Security
  5. {
  6. sealed class LaxTimestampLastModeSecurityHeaderElementInferenceEngine : LaxModeSecurityHeaderElementInferenceEngine
  7. {
  8. static LaxTimestampLastModeSecurityHeaderElementInferenceEngine instance = new LaxTimestampLastModeSecurityHeaderElementInferenceEngine();
  9. LaxTimestampLastModeSecurityHeaderElementInferenceEngine() { }
  10. internal new static LaxTimestampLastModeSecurityHeaderElementInferenceEngine Instance
  11. {
  12. get { return instance; }
  13. }
  14. public override void MarkElements(ReceiveSecurityHeaderElementManager elementManager, bool messageSecurityMode)
  15. {
  16. for (int position = 0; position < elementManager.Count - 1; position++)
  17. {
  18. if (elementManager.GetElementCategory(position) == ReceiveSecurityHeaderElementCategory.Timestamp)
  19. {
  20. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.TimestampMustOccurLastInSecurityHeaderLayout)));
  21. }
  22. }
  23. base.MarkElements(elementManager, messageSecurityMode);
  24. }
  25. }
  26. }