* JWT Auth * Standardized url variable additions * formatting and minor refactoring * this isn't needed * allow channel logos without auth * update changelog --------- Co-authored-by: Ministorm3 <4474921+Ministorm3@users.noreply.github.com>
21 lines
600 B
C#
21 lines
600 B
C#
using Microsoft.IdentityModel.Tokens;
|
|
using System.Text;
|
|
|
|
namespace ErsatzTV;
|
|
|
|
public static class JwtHelper
|
|
{
|
|
public static void Init(IConfiguration configuration)
|
|
{
|
|
string issuerSigningKey = configuration["JWT:IssuerSigningKey"];
|
|
IsEnabled = !string.IsNullOrWhiteSpace(issuerSigningKey);
|
|
if (IsEnabled)
|
|
{
|
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(issuerSigningKey!));
|
|
}
|
|
}
|
|
|
|
public static SymmetricSecurityKey IssuerSigningKey { get; private set; }
|
|
public static bool IsEnabled { get; private set; }
|
|
}
|