aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/CommonExtensions.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-10-30 17:39:39 -0500
committerJP Dillingham <jp@dillingham.me>2022-10-30 17:39:39 -0500
commitdda92d4efc1c4b6d83a5a2a2a1fe637f6d83f58f (patch)
tree5c6ae48fdb3c34ed818ce848d508941bdc1f3c6c /src/slskd/Common/CommonExtensions.cs
parent70d99495146fed87fad93aae593acf0ee686f9b9 (diff)
downloadslskd-dda92d4efc1c4b6d83a5a2a2a1fe637f6d83f58f.tar.gz
fix signalR api key support
Diffstat (limited to 'src/slskd/Common/CommonExtensions.cs')
-rw-r--r--src/slskd/Common/CommonExtensions.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/slskd/Common/CommonExtensions.cs b/src/slskd/Common/CommonExtensions.cs
index 9cf80a4a..29383fcb 100644
--- a/src/slskd/Common/CommonExtensions.cs
+++ b/src/slskd/Common/CommonExtensions.cs
@@ -20,6 +20,7 @@ namespace slskd
using System;
using System.Collections;
using System.Collections.Generic;
+ using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Linq;
using System.Numerics;
@@ -178,6 +179,14 @@ namespace slskd
}
/// <summary>
+ /// Serializes the JWT.
+ /// </summary>
+ /// <param name="jwt">The JWT.</param>
+ /// <returns>The serialized string.</returns>
+ public static string Serialize(this JwtSecurityToken jwt)
+ => new JwtSecurityTokenHandler().WriteToken(jwt);
+
+ /// <summary>
/// Formats byte to nearest size (KB, MB, etc.)
/// </summary>
/// <param name="value">The value to format.</param>