diff --git a/.github/workflows/build-dotnet.yml b/.github/workflows/build-dotnet.yml index ba99431..1395b38 100644 --- a/.github/workflows/build-dotnet.yml +++ b/.github/workflows/build-dotnet.yml @@ -15,7 +15,7 @@ jobs: - name: "Setup .NET Core" uses: actions/setup-dotnet@v1 with: - dotnet-version: "8.0.x" + dotnet-version: "5.0.x" - name: "Install dependencies" run: dotnet restore diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6696a94..c6ee551 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,7 +25,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 8.0.x + dotnet-version: 5.0.x - name: Initialize CodeQL uses: github/codeql-action/init@v1 diff --git a/.gitignore b/.gitignore index c43d422..03c9b93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ bin/ obj/ -.idea/ -*.DotSettings.user .vs/ diff --git a/Jellyfin.Plugin.Keycloak/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.Keycloak/Configuration/PluginConfiguration.cs index bc018d6..12a92e3 100644 --- a/Jellyfin.Plugin.Keycloak/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.Keycloak/Configuration/PluginConfiguration.cs @@ -1,94 +1,25 @@ using MediaBrowser.Model.Plugins; -namespace Jellyfin.Plugin.Keycloak.Configuration; - -/// -/// The main plugin. -/// -public class PluginConfiguration : BasePluginConfiguration +namespace Jellyfin.Plugin.Keycloak.Configuration { - /// - /// Initializes a new instance of the class. - /// - public PluginConfiguration() + + public class PluginConfiguration : BasePluginConfiguration { - // 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(); + public bool CreateUser { get; set; } + public string AuthServerUrl { get; set; } + public string Realm { get; set; } + public string Resource { get; set; } + public string ClientSecret { get; set; } + + + public PluginConfiguration() + { + // set default options here + CreateUser = true; + AuthServerUrl = ""; + Realm = ""; + Resource = ""; + ClientSecret = ""; + } } - - /// - /// Gets or sets a value indicating whether Keycloak authentication is enabled. - /// - public bool Enabled { get; set; } - - /// - /// Gets or sets a value indicating whether creation of new users that dont exist in Jellyfin is enabled. - /// - public bool CreateUser { get; set; } - - /// - /// Gets or sets a value indicating whether 2-factor authentication (Password+TOTP). - /// - public bool Enable2Fa { get; set; } - - /// - /// Gets or sets Keycloak server URL. - /// - public string AuthServerUrl { get; set; } - - /// - /// Gets or sets Keycloak server realm. - /// - public string Realm { get; set; } - - /// - /// Gets or sets Keycloak client ID. - /// - public string ClientId { get; set; } - - /// - /// Gets or sets Keycloak client secret. - /// - public string ClientSecret { get; set; } - - /// - /// Gets or sets Keycloak OAuth scope. - /// - public string OAuthScope { get; set; } - - /// - /// Gets or sets Keycloak username token attribute. - /// - public string UsernameTokenAttribute { get; set; } - - /// - /// Gets or sets Keycloak roles token attribute. - /// - public string RolesTokenAttribute { get; set; } - - /// - /// Gets or sets a value indicating whether users without a role are allowed to log in. - /// - public bool AllowUsersWithoutRole { get; set; } - - /// - /// Gets or sets a value indicating whether to enable access to all library folders. - /// - public bool EnableAllFolders { get; set; } - - /// - /// Gets or sets a list of folder Ids which are enabled for access by default. - /// - public string[] EnabledFolders { get; set; } } diff --git a/Jellyfin.Plugin.Keycloak/Configuration/configPage.html b/Jellyfin.Plugin.Keycloak/Configuration/configPage.html index c11d588..c23d4e7 100644 --- a/Jellyfin.Plugin.Keycloak/Configuration/configPage.html +++ b/Jellyfin.Plugin.Keycloak/Configuration/configPage.html @@ -8,75 +8,33 @@ - Keycloak Authentication - - - - Enable Keycloak authentication - - - Create Keycloak user if it does not exist + Create User if doesn't exist - - - - Enable Two-factor authentication - - You need to add the TOTP (6 digits) to the password when logging in - - Keycloak server URL + Auth Server URL + Base Keycloak auth URI - Keycloak Realm + Realm + Keycloak Realm - Client ID - + Resource/Client + + Keycloak Resource/Client Client Secret + Client Secret - - OAuth Scope - - - - Roles token attribute - - Access token attribute with the list of roles. Seperate keys with a '.' if the role list is part of a nested object. - - - Username token attribute - - Access token attribute with the username - - - - - Allow users without a role to log in - - - - - - Enable access to all libraries - - - - Enable access to certain libraries by default - Add library access to certain users by giving them the 'lib-<ID>' role - - - Save @@ -88,41 +46,23 @@