jellyfin-plugin-keycloak-auth/Jellyfin.Plugin.Keycloak/Configuration/PluginConfiguration.cs
2025-03-31 00:08:54 +02:00

94 lines
2.8 KiB
C#

using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.Keycloak.Configuration;
/// <summary>
/// The main plugin.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
/// </summary>
public PluginConfiguration()
{
// set default options here
this.Enabled = false;
this.CreateUser = true;
this.Enable2Fa = false;
this.AuthServerUrl = string.Empty;
this.Realm = "master";
this.ClientId = string.Empty;
this.ClientSecret = string.Empty;
this.OAuthScope = string.Empty;
this.RolesTokenAttribute = string.Empty;
this.UsernameTokenAttribute = "preferred_username";
this.EnableAllFolders = false;
this.EnabledFolders = System.Array.Empty<string>();
}
/// <summary>
/// Gets or sets a value indicating whether Keycloak authentication is enabled.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether creation of new users that dont exist in Jellyfin is enabled.
/// </summary>
public bool CreateUser { get; set; }
/// <summary>
/// Gets or sets a value indicating whether 2-factor authentication (Password+TOTP).
/// </summary>
public bool Enable2Fa { get; set; }
/// <summary>
/// Gets or sets Keycloak server URL.
/// </summary>
public string AuthServerUrl { get; set; }
/// <summary>
/// Gets or sets Keycloak server realm.
/// </summary>
public string Realm { get; set; }
/// <summary>
/// Gets or sets Keycloak client ID.
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// Gets or sets Keycloak client secret.
/// </summary>
public string ClientSecret { get; set; }
/// <summary>
/// Gets or sets Keycloak OAuth scope.
/// </summary>
public string OAuthScope { get; set; }
/// <summary>
/// Gets or sets Keycloak username token attribute.
/// </summary>
public string UsernameTokenAttribute { get; set; }
/// <summary>
/// Gets or sets Keycloak roles token attribute.
/// </summary>
public string RolesTokenAttribute { get; set; }
/// <summary>
/// Gets or sets a value indicating whether users without a role are allowed to log in.
/// </summary>
public bool AllowUsersWithoutRole { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable access to all library folders.
/// </summary>
public bool EnableAllFolders { get; set; }
/// <summary>
/// Gets or sets a list of folder Ids which are enabled for access by default.
/// </summary>
public string[] EnabledFolders { get; set; }
}