diff --git a/src/Momento.Sdk/AuthClient.cs b/src/Momento.Sdk/AuthClient.cs
index 6c2ed68e..8a69e183 100644
--- a/src/Momento.Sdk/AuthClient.cs
+++ b/src/Momento.Sdk/AuthClient.cs
@@ -24,7 +24,7 @@ public AuthClient(IAuthConfiguration config, ICredentialProvider authProvider)
{
scsTokenClient = new ScsTokenClient(config, authProvider.AuthToken, authProvider.TokenEndpoint);
}
-
+
///
public async Task GenerateDisposableTokenAsync(DisposableTokenScope scope, ExpiresIn expiresIn, string? tokenId = null)
{
diff --git a/src/Momento.Sdk/Internal/ScsDataClient.cs b/src/Momento.Sdk/Internal/ScsDataClient.cs
index 82cb2bac..eda0b5a5 100644
--- a/src/Momento.Sdk/Internal/ScsDataClient.cs
+++ b/src/Momento.Sdk/Internal/ScsDataClient.cs
@@ -49,7 +49,7 @@ protected Metadata MetadataWithCache(string cacheName)
this.hasSentOnetimeHeaders = true;
string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
- return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
+ return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:cache:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
}
protected DateTime CalculateDeadline()
{
diff --git a/src/Momento.Sdk/Internal/ScsTokenClient.cs b/src/Momento.Sdk/Internal/ScsTokenClient.cs
index af9c1ae3..d7e2b97c 100644
--- a/src/Momento.Sdk/Internal/ScsTokenClient.cs
+++ b/src/Momento.Sdk/Internal/ScsTokenClient.cs
@@ -1,6 +1,7 @@
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
+using System.Reflection;
using System.Threading.Tasks;
using Grpc.Core;
using Microsoft.Extensions.Logging;
@@ -21,6 +22,7 @@ internal sealed class ScsTokenClient : IDisposable
private readonly string authToken;
private readonly TimeSpan authClientOperationTimeout;
private readonly ILogger _logger;
+ private bool hasSentOnetimeHeaders = false;
private readonly CacheExceptionMapper _exceptionMapper;
public ScsTokenClient(IAuthConfiguration config, string authToken, string endpoint)
{
@@ -30,6 +32,17 @@ public ScsTokenClient(IAuthConfiguration config, string authToken, string endpoi
this._logger = config.LoggerFactory.CreateLogger();
this._exceptionMapper = new CacheExceptionMapper(config.LoggerFactory);
}
+
+ private Metadata Metadata()
+ {
+ if (this.hasSentOnetimeHeaders) {
+ return new Metadata();
+ }
+ this.hasSentOnetimeHeaders = true;
+ string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
+ return new Metadata() { { "Agent", $"dotnet:auth:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
+ }
private DateTime CalculateDeadline()
{
@@ -65,9 +78,10 @@ public async Task GenerateDisposableToken(
Permissions = permissions,
TokenId = tokenId ?? ""
};
+ var metadata = Metadata();
_logger.LogTraceExecutingGenericRequest(RequestTypeAuthGenerateDisposableToken);
var response = await grpcManager.Client.generateDisposableToken(
- request, new CallOptions(deadline: CalculateDeadline())
+ request, new CallOptions(headers: metadata, deadline: CalculateDeadline())
);
return _logger.LogTraceGenericRequestSuccess(RequestTypeAuthGenerateDisposableToken,
new GenerateDisposableTokenResponse.Success(response));
diff --git a/src/Momento.Sdk/Internal/ScsTopicClient.cs b/src/Momento.Sdk/Internal/ScsTopicClient.cs
index befce00d..0fd90ae6 100644
--- a/src/Momento.Sdk/Internal/ScsTopicClient.cs
+++ b/src/Momento.Sdk/Internal/ScsTopicClient.cs
@@ -31,7 +31,7 @@ public ScsTopicClientBase(ITopicConfiguration config, string authToken, string e
this._exceptionMapper = new CacheExceptionMapper(config.LoggerFactory);
}
- protected Metadata MetadataWithCache(string cacheName)
+ private Metadata MetadataWithCache(string cacheName)
{
if (this.hasSentOnetimeHeaders) {
return new Metadata() { { "cache", cacheName } };
@@ -39,7 +39,7 @@ protected Metadata MetadataWithCache(string cacheName)
this.hasSentOnetimeHeaders = true;
string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
- return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
+ return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:topic:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
}
protected DateTime CalculateDeadline()