mirror of
https://github.com/9p4/jellyfin-plugin-sso
synced 2026-10-25 22:39:18 +11:00
Removed errors and warnings
This commit is contained in:
@@ -311,7 +311,7 @@ public class SSOController : ControllerBase
|
||||
{
|
||||
if (kvp.Value.State.State.Equals(response.Data) && kvp.Value.Valid)
|
||||
{
|
||||
var authenticationResult = await Authenticate(kvp.Value.Username, kvp.Value.Admin, config.EnableAuthorization, config.EnableAllFolders, kvp.Value.Folders.ToArray(), response)
|
||||
var authenticationResult = await Authenticate(kvp.Value.Username, kvp.Value.Admin, config.EnableAuthorization, config.EnableAllFolders, kvp.Value.Folders.ToArray(), response, config.DefaultProvider)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(authenticationResult);
|
||||
}
|
||||
@@ -484,11 +484,12 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
var authenticationResult = await Authenticate(samlResponse.GetNameID(), isAdmin, config.EnableAuthorization, config.EnableAllFolders, folders.ToArray(), response)
|
||||
var authenticationResult = await Authenticate(samlResponse.GetNameID(), isAdmin, config.EnableAuthorization, config.EnableAllFolders, folders.ToArray(), response, config.DefaultProvider)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(authenticationResult);
|
||||
}
|
||||
}
|
||||
|
||||
return Problem("Something went wrong");
|
||||
}
|
||||
|
||||
@@ -517,7 +518,8 @@ public class SSOController : ControllerBase
|
||||
/// <param name="enableAllFolders">Determines whether all folders are enabled.</param>
|
||||
/// <param name="enabledFolders">Determines which folders should be enabled for this client.</param>
|
||||
/// <param name="authResponse">The client information to authenticate the user with.</param>
|
||||
private async Task<AuthenticationResult> Authenticate(string username, bool isAdmin, bool enableAuthorization, bool enableAllFolders, string[] enabledFolders, AuthResponse authResponse)
|
||||
/// <param name="defaultProvider">The default provider of the user to be set after logging in.</param>
|
||||
private async Task<AuthenticationResult> Authenticate(string username, bool isAdmin, bool enableAuthorization, bool enableAllFolders, string[] enabledFolders, AuthResponse authResponse, string defaultProvider)
|
||||
{
|
||||
User user = null;
|
||||
user = _userManager.GetUserByName(username);
|
||||
@@ -549,14 +551,13 @@ public class SSOController : ControllerBase
|
||||
authRequest.DeviceId = authResponse.DeviceID;
|
||||
authRequest.DeviceName = authResponse.DeviceName;
|
||||
_logger.LogInformation("Auth request created...");
|
||||
if (config.DefaultProvider != "")
|
||||
{
|
||||
User user = null;
|
||||
user = _userManager.GetUserByName(kvp.Value.Username);
|
||||
user.AuthenticationProviderId = config.DefaultProvider;
|
||||
await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
|
||||
_logger.LogInformation("Set default login provider to " + config.DefaultProvider);
|
||||
if (!String.IsNullOrEmpty(defaultProvider))
|
||||
{
|
||||
user.AuthenticationProviderId = defaultProvider;
|
||||
await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
|
||||
_logger.LogInformation("Set default login provider to " + defaultProvider);
|
||||
}
|
||||
|
||||
return await _sessionManager.AuthenticateDirect(authRequest).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class SamlConfig
|
||||
public List<FolderRoleMap> FolderRoleMapping { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default provider the user gets set to after logging in with SSO
|
||||
/// Gets or sets the default provider the user after logging in with SSO.
|
||||
/// </summary>
|
||||
public string DefaultProvider { get; set; }
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class OIDConfig
|
||||
public string RoleClaim { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default provider the user gets set to after logging in with SSO
|
||||
/// Gets or sets the default provider the user after logging in with SSO.
|
||||
/// </summary>
|
||||
public string DefaultProvider { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
rm -rf SSO-Auth/bin
|
||||
docker run --rm -v /blyatflix/home/SSO/jellyfin-plugin-sso:/app -w /app mcr.microsoft.com/dotnet/sdk:6.0 dotnet publish .
|
||||
rm -rf /blyatflix/apps/jellyfin/config/data/plugins/sso
|
||||
docker restart jellyfin
|
||||
mkdir /blyatflix/apps/jellyfin/config/data/plugins/sso
|
||||
cp SSO-Auth/bin/Debug/net6.0/publish/SSO-Auth.dll /blyatflix/apps/jellyfin/config/data/plugins/sso/
|
||||
cp SSO-Auth/bin/Debug/net6.0/publish/IdentityModel.dll /blyatflix/apps/jellyfin/config/data/plugins/sso/
|
||||
cp SSO-Auth/bin/Debug/net6.0/publish/IdentityModel.OidcClient.dll /blyatflix/apps/jellyfin/config/data/plugins/sso/
|
||||
chown -R 1000:1000 /blyatflix/apps/jellyfin/config/data/plugins/sso
|
||||
docker restart jellyfin
|
||||
Reference in New Issue
Block a user