로그인 STA 스레드화·SSO 로그아웃·UserInfo 역직렬화 수정 및 AuthTest 추가

- LoginWindow: 로그인/로그아웃/쿠키삭제를 전용 STA 스레드(자체 Dispatcher 펌프)에서 실행
  → SignIn/SignInAsync가 MTA/STA 어느 스레드에서 호출돼도 동작 (RunOnDedicatedUiThreadAsync, AuthenticateAsync)
- SsoClient: 로그인/로그아웃 창을 AuthenticateAsync로 호출, 크로스스레드 Owner 제거
- BaronSSO: SignIn/SignOut을 Task.Run(...).GetAwaiter().GetResult()로 정리, SignInAsync 데드락 주석 추가
- UserInfo: private set 프로퍼티에 [JsonInclude] 적용 → FromSsoFile 역직렬화 복원 정상화, LastAuthTime [JsonIgnore]
- AuthTest 샘플 프로젝트 추가

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 19:20:12 +09:00
parent a15cab4bc9
commit dd2c4e4975
14 changed files with 277 additions and 45 deletions

10
AuthTest/App.xaml Normal file
View File

@@ -0,0 +1,10 @@
<Application x:Class="AuthTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AuthTest"
ShutdownMode="OnMainWindowClose"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

31
AuthTest/App.xaml.cs Normal file
View File

@@ -0,0 +1,31 @@
using BaronSoftware.SSO;
using System.Configuration;
using System.Data;
using System.Threading.Tasks;
using System.Windows;
namespace AuthTest
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
BaronSSOOption option = new()
{
Authority = "https://sso.hmac.kr/oidc",
ClientId = "aca44872-8280-40c3-9a80-3aefafdf722a",
RedirectUri = "http://localhost:9090/eg-bim/auth/callback",
PostLogoutRedirectUri = "http://localhost:9090/eg-bim/logout/callback",
ExtraUserValidator = new ExtraUserInvalidator()
};
var auth = new BaronSSO(option);
auth.SignIn();
}
}
}

10
AuthTest/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

15
AuthTest/AuthTest.csproj Normal file
View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BaronSoftware.SSO\BaronSoftware.SSO.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,16 @@
using BaronSoftware.SSO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AuthTest
{
public class ExtraUserInvalidator : IUserValidator
{
public void Validate(UserInfo user)
{
}
}
}

12
AuthTest/MainWindow.xaml Normal file
View File

@@ -0,0 +1,12 @@
<Window x:Class="AuthTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AuthTest"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@@ -0,0 +1,24 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace AuthTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}