@@ -22,10 +22,15 @@ public partial class MFWSClient
2222 /// </summary>
2323 protected const string XAuthenticationHttpHeaderName = "X-Authentication" ;
2424
25+ /// <summary>
26+ /// The HTTP header name used to maintain the active vault (if multiple vaults and using SSO).
27+ /// </summary>
28+ protected const string XActiveVaultHttpHeaderName = "X-Active-Vault" ;
29+
2530 /// <summary>
2631 /// The HTTP header name used for the vault guid (<see cref="AddVaultHeader(System.Guid)"/>).
2732 /// </summary>
28- protected const string VaultHttpHeaderName = "X-Vault" ;
33+ protected const string XVaultHttpHeaderName = "X-Vault" ;
2934
3035 /// <summary>
3136 /// This is the authentication token used in the request headers.
@@ -69,7 +74,7 @@ public void AddVaultHeader(Guid vaultGuid)
6974 /// <remarks>Typically used with OAuth authentication tokens.</remarks>
7075 public void AddVaultHeader ( string vaultGuid )
7176 {
72- this . AddDefaultHeader ( MFWSClient . VaultHttpHeaderName , vaultGuid ) ;
77+ this . AddDefaultHeader ( MFWSClient . XVaultHttpHeaderName , vaultGuid ) ;
7378 }
7479
7580 /// <summary>
@@ -78,7 +83,7 @@ public void AddVaultHeader(string vaultGuid)
7883 public void ClearVaultHeader ( )
7984 {
8085 // Remove the authorisation header.
81- foreach ( var parameter in this . DefaultParameters . Where ( p => p . Name == MFWSClient . VaultHttpHeaderName )
86+ foreach ( var parameter in this . DefaultParameters . Where ( p => p . Name == MFWSClient . XVaultHttpHeaderName )
8287 . ToArray ( ) )
8388 {
8489 this . DefaultParameters . Remove ( parameter ) ;
@@ -98,7 +103,13 @@ protected virtual void ClearAuthenticationToken()
98103 this . CookieContainer = new CookieContainer ( ) ;
99104
100105 // Remove the authorisation header.
101- foreach ( var parameter in this . DefaultParameters . Where ( p => p . Name == MFWSClient . AuthorizationHttpHeaderName )
106+ foreach ( var parameter in this
107+ . DefaultParameters
108+ . Where
109+ (
110+ p => p . Name == MFWSClient . AuthorizationHttpHeaderName
111+ || p . Name == MFWSClient . XActiveVaultHttpHeaderName
112+ )
102113 . ToArray ( ) )
103114 {
104115 this . DefaultParameters . Remove ( parameter ) ;
@@ -137,6 +148,9 @@ protected virtual void ClearAuthenticationToken()
137148 this . CookieContainer . Add ( this . BaseUrl , new Cookie ( cookie . Name , cookie . Value , cookie . Path , cookie . Domain ) ) ;
138149 }
139150 }
151+
152+ // Ensure that the active vault is stored.
153+ this . AddDefaultHeader ( MFWSClient . XActiveVaultHttpHeaderName , vaultId . ToString ( "B" ) ) ;
140154 }
141155
142156 /// <summary>
0 commit comments