using System; using System.Collections.Generic; using System.Xml.Serialization; namespace Jellyfin.Plugin.SSO_Auth.Config; /// /// Plugin Configuration. /// public class PluginConfiguration : MediaBrowser.Model.Plugins.BasePluginConfiguration { /// /// Initializes a new instance of the class. /// public PluginConfiguration() { SamlConfigs = new SerializableDictionary(); OidConfigs = new SerializableDictionary(); } /// /// Gets or sets the SAML configurations available. /// [XmlElement("SamlConfigs")] public SerializableDictionary SamlConfigs { get; set; } /// /// Gets or sets the OpenID configurations available. /// [XmlElement("OidConfigs")] public SerializableDictionary OidConfigs { get; set; } } /// /// The configuration required for a SAML flow. /// [XmlRoot("PluginConfiguration")] public class SamlConfig { private SerializableDictionary _canonicalLinks; /// /// Gets or sets the SAML information endpoint. /// public string SamlEndpoint { get; set; } /// /// Gets or sets the SAML provider's client ID. /// public string SamlClientId { get; set; } /// /// Gets or sets the SAML public key. /// public string SamlCertificate { get; set; } /// /// Gets or sets a value indicating whether the provider is enabled. /// public bool Enabled { get; set; } /// /// Gets or sets a value indicating whether RBAC is enabled. /// public bool EnableAuthorization { get; set; } /// /// Gets or sets a value indicating whether all folders are allowed by default. /// public bool EnableAllFolders { get; set; } /// /// Gets or sets what folders should users have access to by default. /// public string[] EnabledFolders { get; set; } /// /// Gets or sets the roles that are checked to determine whether the user is an administrator. /// public string[] AdminRoles { get; set; } /// /// Gets or sets what roles are checked to determine whether the user is allowed to use Jellyfin. /// public string[] Roles { get; set; } /// /// Gets or sets a value indicating whether RBAC is used to manage folder access. /// public bool EnableFolderRoles { get; set; } /// /// Gets or sets which folders map to what roles in RBAC. /// [XmlArray("FolderRoleMappings")] [XmlArrayItem(typeof(FolderRoleMap), ElementName = "FolderRoleMappings")] public List FolderRoleMapping { get; set; } /// /// Gets or sets the default provider the user after logging in with SSO. /// public string DefaultProvider { get; set; } /// /// Gets or sets a mapping of canonical names from the provider to jellyfin user ids. /// [XmlElement("CanonicalLinks")] public SerializableDictionary CanonicalLinks { get { if (_canonicalLinks == null) { return new SerializableDictionary(); } return _canonicalLinks; } set => _canonicalLinks = value; } } /// /// The configuration required for a OpenID flow. /// [XmlRoot("PluginConfiguration")] public class OidConfig { private SerializableDictionary _canonicalLinks; /// /// Gets or sets the OpenID well-known information endpoint. /// public string OidEndpoint { get; set; } /// /// Gets or sets OpenID client ID. /// public string OidClientId { get; set; } /// /// Gets or sets OpenID shared secret. /// public string OidSecret { get; set; } /// /// Gets or sets a value indicating whether the provider is enabled. /// public bool Enabled { get; set; } /// /// Gets or sets a value indicating whether RBAC is enabled. /// public bool EnableAuthorization { get; set; } /// /// Gets or sets a value indicating whether all folders are allowed by default. /// public bool EnableAllFolders { get; set; } /// /// Gets or sets what folders should users have access to by default. /// public string[] EnabledFolders { get; set; } /// /// Gets or sets the roles that are checked to determine whether the user is an administrator. /// public string[] AdminRoles { get; set; } /// /// Gets or sets what roles are checked to determine whether the user is allowed to use Jellyfin. /// public string[] Roles { get; set; } /// /// Gets or sets a value indicating whether RBAC is used to manage folder access. /// public bool EnableFolderRoles { get; set; } /// /// Gets or sets which folders map to what roles in RBAC. /// [XmlArray("FolderRoleMappings")] [XmlArrayItem(typeof(FolderRoleMap), ElementName = "FolderRoleMappings")] public List FolderRoleMapping { get; set; } /// /// Gets or sets the claim to check roles against. Separated by "."s. /// public string RoleClaim { get; set; } /// /// Gets or Sets additional Scopes to request access to in the authorization request. /// public string[] OidScopes { get; set; } /// /// Gets or sets the default provider the user after logging in with SSO. /// public string DefaultProvider { get; set; } /// /// Gets or sets a mapping of canonical names from the provider to jellyfin user ids. /// [XmlElement("CanonicalLinks")] public SerializableDictionary CanonicalLinks { get { if (_canonicalLinks == null) { return new SerializableDictionary(); } return _canonicalLinks; } set => _canonicalLinks = value; } } /// /// The OpenID client ID. /// public class FolderRoleMap { /// /// Gets or sets the role of the mapping. /// public string Role { get; set; } /// /// Gets or sets the folders that are allowed from the given role. /// public List Folders { get; set; } }