Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions MFaaP.MFWSClient/MFWSClient.Authentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ public partial class MFWSClient
/// </summary>
protected const string XAuthenticationHttpHeaderName = "X-Authentication";

/// <summary>
/// The HTTP header name used to maintain the active vault (if multiple vaults and using SSO).
/// </summary>
protected const string XActiveVaultHttpHeaderName = "X-Active-Vault";

/// <summary>
/// The HTTP header name used for the vault guid (<see cref="AddVaultHeader(System.Guid)"/>).
/// </summary>
protected const string VaultHttpHeaderName = "X-Vault";
protected const string XVaultHttpHeaderName = "X-Vault";

/// <summary>
/// This is the authentication token used in the request headers.
Expand Down Expand Up @@ -69,7 +74,7 @@ public void AddVaultHeader(Guid vaultGuid)
/// <remarks>Typically used with OAuth authentication tokens.</remarks>
public void AddVaultHeader(string vaultGuid)
{
this.AddDefaultHeader(MFWSClient.VaultHttpHeaderName, vaultGuid);
this.AddDefaultHeader(MFWSClient.XVaultHttpHeaderName, vaultGuid);
}

/// <summary>
Expand All @@ -78,7 +83,7 @@ public void AddVaultHeader(string vaultGuid)
public void ClearVaultHeader()
{
// Remove the authorisation header.
foreach (var parameter in this.DefaultParameters.Where(p => p.Name == MFWSClient.VaultHttpHeaderName)
foreach (var parameter in this.DefaultParameters.Where(p => p.Name == MFWSClient.XVaultHttpHeaderName)
.ToArray())
{
this.DefaultParameters.Remove(parameter);
Expand All @@ -98,7 +103,13 @@ protected virtual void ClearAuthenticationToken()
this.CookieContainer = new CookieContainer();

// Remove the authorisation header.
foreach (var parameter in this.DefaultParameters.Where(p => p.Name == MFWSClient.AuthorizationHttpHeaderName)
foreach (var parameter in this
.DefaultParameters
.Where
(
p => p.Name == MFWSClient.AuthorizationHttpHeaderName
|| p.Name == MFWSClient.XActiveVaultHttpHeaderName
)
.ToArray())
{
this.DefaultParameters.Remove(parameter);
Expand Down Expand Up @@ -137,6 +148,9 @@ protected virtual void ClearAuthenticationToken()
this.CookieContainer.Add(this.BaseUrl, new Cookie(cookie.Name, cookie.Value, cookie.Path, cookie.Domain));
}
}

// Ensure that the active vault is stored.
this.AddDefaultHeader(MFWSClient.XActiveVaultHttpHeaderName, vaultId.ToString("B"));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion MFaaP.MFWSClient/MFaaP.MFWSClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<PropertyGroup>
<Version>1.2.3-alpha</Version>
<Version>1.2.4-alpha</Version>
<Authors>M-Files Corporation</Authors>
<Description>Sample .NET wrapper for the M-Files Web Service. Not designed for production use.</Description>
<Copyright>Copyright (c) 2020 onwards, M-Files Corporation</Copyright>
Expand Down
Binary file removed current/MFaaP.MFWSClient.1.2.3-alpha.nupkg
Binary file not shown.
Binary file added current/MFaaP.MFWSClient.1.2.4-alpha.nupkg
Binary file not shown.