mirror of
https://github.com/9p4/jellyfin-plugin-sso.git
synced 2026-09-19 13:12:19 +00:00
feat: allow configuration of preferred username claim (#47)
This commit is contained in:
@@ -104,7 +104,7 @@ public class SSOController : ControllerBase
|
|||||||
|
|
||||||
foreach (var claim in result.User.Claims)
|
foreach (var claim in result.User.Claims)
|
||||||
{
|
{
|
||||||
if (claim.Type == "preferred_username")
|
if (claim.Type == (config.DefaultUsernameClaim ?? "preferred_username"))
|
||||||
{
|
{
|
||||||
StateManager[state].Username = claim.Value;
|
StateManager[state].Username = claim.Value;
|
||||||
if (config.Roles.Length == 0)
|
if (config.Roles.Length == 0)
|
||||||
@@ -186,7 +186,7 @@ public class SSOController : ControllerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the provider doesn't support preferred_username, then use sub
|
// If the provider doesn't support the preferred username claim, then use the sub claim
|
||||||
if (!StateManager[state].Valid)
|
if (!StateManager[state].Valid)
|
||||||
{
|
{
|
||||||
foreach (var claim in result.User.Claims)
|
foreach (var claim in result.User.Claims)
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ public class OidConfig
|
|||||||
}
|
}
|
||||||
set => _canonicalLinks = value;
|
set => _canonicalLinks = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the default username claim when creating new accounts.
|
||||||
|
/// </summary>
|
||||||
|
public string DefaultUsernameClaim { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user