diff --git a/src/Microsoft.Azure.SignalR.Common/Auth/AccessKey.cs b/src/Microsoft.Azure.SignalR.Common/Auth/AccessKey.cs index b16d4bff6..2a036cf28 100644 --- a/src/Microsoft.Azure.SignalR.Common/Auth/AccessKey.cs +++ b/src/Microsoft.Azure.SignalR.Common/Auth/AccessKey.cs @@ -7,42 +7,41 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.Azure.SignalR +namespace Microsoft.Azure.SignalR; + +internal class AccessKey { - internal class AccessKey + public string Id => Key?.Item1; + + public string Value => Key?.Item2; + + public Uri Endpoint { get; } + + protected Tuple Key { get; set; } + + public AccessKey(string uri, string key) : this(new Uri(uri)) + { + Key = new Tuple(key.GetHashCode().ToString(), key); + } + + public AccessKey(Uri uri, string key) : this(uri) + { + Key = new Tuple(key.GetHashCode().ToString(), key); + } + + protected AccessKey(Uri uri) + { + Endpoint = uri; + } + + public virtual Task GenerateAccessTokenAsync( + string audience, + IEnumerable claims, + TimeSpan lifetime, + AccessTokenAlgorithm algorithm, + CancellationToken ctoken = default) { - public string Id => Key?.Item1; - - public string Value => Key?.Item2; - - public Uri Endpoint { get; } - - protected Tuple Key { get; set; } - - public AccessKey(string uri, string key) : this(new Uri(uri)) - { - Key = new Tuple(key.GetHashCode().ToString(), key); - } - - public AccessKey(Uri uri, string key) : this(uri) - { - Key = new Tuple(key.GetHashCode().ToString(), key); - } - - protected AccessKey(Uri uri) - { - Endpoint = uri; - } - - public virtual Task GenerateAccessTokenAsync( - string audience, - IEnumerable claims, - TimeSpan lifetime, - AccessTokenAlgorithm algorithm, - CancellationToken ctoken = default) - { - var token = AuthUtility.GenerateAccessToken(this, audience, claims, lifetime, algorithm); - return Task.FromResult(token); - } + var token = AuthUtility.GenerateAccessToken(this, audience, claims, lifetime, algorithm); + return Task.FromResult(token); } } \ No newline at end of file