From 5da7e02faf652e19fabf33f3fdaf2e706f0bfead Mon Sep 17 00:00:00 2001 From: Matthew Strasiotto <39424834+matthewstrasiotto@users.noreply.github.com> Date: Thu, 26 May 2022 19:17:58 +1000 Subject: [PATCH] Fix ID Provider incorrectly resetting on login --- SSO-Auth/Api/SSOController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SSO-Auth/Api/SSOController.cs b/SSO-Auth/Api/SSOController.cs index 8d4402c..ad974cb 100644 --- a/SSO-Auth/Api/SSOController.cs +++ b/SSO-Auth/Api/SSOController.cs @@ -563,9 +563,9 @@ public class SSOController : ControllerBase { _logger.LogInformation("SSO user doesn't exist, creating..."); user = await _userManager.CreateUserAsync(username).ConfigureAwait(false); + user.AuthenticationProviderId = GetType().FullName; } - user.AuthenticationProviderId = GetType().FullName; if (enableAuthorization) { user.SetPermission(PermissionKind.IsAdministrator, isAdmin); @@ -588,9 +588,9 @@ public class SSOController : ControllerBase _logger.LogInformation("Auth request created..."); if (!string.IsNullOrEmpty(defaultProvider)) { - user.AuthenticationProviderId = defaultProvider; - await _userManager.UpdateUserAsync(user).ConfigureAwait(false); - _logger.LogInformation("Set default login provider to " + 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);