diff --git a/SSO-Auth/Api/SSOController.cs b/SSO-Auth/Api/SSOController.cs
index 34fe22c..861ae74 100644
--- a/SSO-Auth/Api/SSOController.cs
+++ b/SSO-Auth/Api/SSOController.cs
@@ -288,12 +288,21 @@ public class SSOController : ControllerBase
if (config.Enabled)
{
+ bool newPath = config.NewPath;
+ if (!isLinking)
+ {
+ newPath = Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase);
+ config.NewPath = newPath;
+ }
+
+ string redirectUri = GetRequestBase(config.SchemeOverride) + $"/sso/OID/{(newPath ? "redirect" : "r")}/" + provider;
+
var options = new OidcClientOptions
{
Authority = config.OidEndpoint?.Trim(),
ClientId = config.OidClientId?.Trim(),
ClientSecret = config.OidSecret?.Trim(),
- RedirectUri = GetRequestBase(config.SchemeOverride) + $"/sso/OID/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "redirect" : "r")}/" + provider,
+ RedirectUri = redirectUri,
Scope = string.Join(" ", config.OidScopes.Prepend("openid profile")),
};
options.Policy.Discovery.ValidateEndpoints = false; // For Google and other providers with different endpoints
@@ -514,6 +523,14 @@ public class SSOController : ControllerBase
if (config.Enabled)
{
+ bool newPath = config.NewPath;
+ if (!isLinking)
+ {
+ newPath = Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase);
+ config.NewPath = newPath;
+ }
+
+ string redirectUri = GetRequestBase(config.SchemeOverride) + $"/sso/SAML/{(newPath ? "post" : "p")}/" + provider;
string relayState = null;
if (isLinking)
{
@@ -522,7 +539,7 @@ public class SSOController : ControllerBase
var request = new AuthRequest(
config.SamlClientId.Trim(),
- GetRequestBase(config.SchemeOverride) + $"/sso/SAML/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "post" : "p")}/" + provider);
+ redirectUri);
return Redirect(request.GetRedirectUrl(config.SamlEndpoint.Trim(), relayState));
}
diff --git a/SSO-Auth/Config/PluginConfiguration.cs b/SSO-Auth/Config/PluginConfiguration.cs
index 1a8650a..767ed2e 100644
--- a/SSO-Auth/Config/PluginConfiguration.cs
+++ b/SSO-Auth/Config/PluginConfiguration.cs
@@ -131,6 +131,11 @@ public class SamlConfig
///
public string SchemeOverride { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the new, more descriptive paths are to be used.
+ ///
+ public bool NewPath { get; set; }
+
///
/// Gets or sets a mapping of canonical names from the provider to jellyfin user ids.
///
@@ -260,6 +265,11 @@ public class OidConfig
///
public string SchemeOverride { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the new, more descriptive paths are to be used.
+ ///
+ public bool NewPath { get; set; }
+
///
/// Gets or sets a mapping of canonical names from the provider to jellyfin user ids.
///