This commit is contained in:
Vashchuk Nikita 2022-04-26 11:49:55 +03:00
parent 62c66e6e1f
commit e812d3ec53

View File

@ -79,7 +79,7 @@ public class SsoHandlerService
MessageService messageService,
DisplayUserSettingsHelper displayUserSettingsHelper)
{
_log = optionsMonitor.Get("ASC");
_log = optionsMonitor.CurrentValue;
_coreBaseSettings = coreBaseSettings;
_userManager = userManager;
_tenantManager = tenantManager;
@ -206,17 +206,19 @@ public class SsoHandlerService
_cookiesManager.ResetUserCookie();
_securityContext.Logout();
context.Response.Redirect(AUTH_PAGE, false);
}
}
catch (SsoException ex)
{
throw ex;
}
catch (Exception e)
{
ErrorWithStatus("Unexpected error. {0}", e);
}
finally
{
await context.Response.CompleteAsync();
//await context.Response.CompleteAsync();
//context.ApplicationInstance.CompleteRequest();
}
}
@ -224,7 +226,7 @@ public class SsoHandlerService
private void ErrorWithStatus(string errorText, object errorArg = null)
{
_log.ErrorFormat(errorText, errorArg);
throw new Exception(string.Format(errorText, errorArg));
throw new SsoException(errorText, errorArg);
}
private UserInfo AddUser(UserInfo userInfo)
@ -274,6 +276,11 @@ public class SsoHandlerService
}
}
public class SsoException : Exception
{
public SsoException(string message, object errorArg) : base(string.Format(message, errorArg)) { }
}
public static class SsoHandlerExtensions
{
public static IApplicationBuilder UseSsoHandler(this IApplicationBuilder builder)