Skip to content

Commit 06a0e34

Browse files
committed
chore: move AuthCallbackHandler to separate Project
1 parent f367dc5 commit 06a0e34

12 files changed

Lines changed: 59 additions & 16 deletions

Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<PackageVersion Include="System.Collections.Immutable" Version="9.0.8" />
1515
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.8" />
1616
<PackageVersion Include="System.ValueTuple" Version="4.6.1" />
17+
<!--<PackageVersion Include="Uno.UI" Version="5.6.99" /> TODO: Decide if using PackageVersion or Uno.Sdk is able to provide the wanted Low dependency level.-->
1718
</ItemGroup>
18-
</Project>
19+
</Project>

Yllibed.HttpServer/Handlers/AuthCallbackHandlerOptions.cs renamed to Yllibed.Handlers.Uno/AuthCallbackHandlerOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.ComponentModel.DataAnnotations;
22

3-
namespace Yllibed.HttpServer.Handlers;
3+
namespace Yllibed.Handlers.Uno;
44
public record AuthCallbackHandlerOptions
55
{
66
public const string SectionName = "AuthCallback";

Yllibed.HttpServer/Defaults/OAuthErrorResponseDefaults.cs renamed to Yllibed.Handlers.Uno/Defaults/OAuthErrorResponseDefaults.cs

File renamed without changes.

Yllibed.HttpServer/Extensions/UriExtensions.cs renamed to Yllibed.Handlers.Uno/Extensions/UriExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.Linq;
33

4-
namespace Yllibed.HttpServer.Extensions;
4+
namespace Yllibed.Handlers.Uno.Extensions;
55

66
public static class UriExtensions
77
{
@@ -14,6 +14,6 @@ public static IDictionary<string, string> GetParameters(this Uri uri)
1414
.Split(_uriSplitChars, StringSplitOptions.RemoveEmptyEntries)
1515
.Select(p => p.Split('='))
1616
.Where(parts => parts.Length > 1)
17-
.ToDictionary(parts => parts[0], parts => String.Join("=", parts.Skip(1)), StringComparer.Ordinal);
17+
.ToDictionary(parts => parts[0], parts => string.Join('=', parts.Skip(1)), StringComparer.Ordinal);
1818
}
1919
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
global using Microsoft.Extensions.Logging;
2+
global using Microsoft.Extensions.Options;
3+
global using Windows.Security.Authentication.Web;
4+
global using Yllibed.HttpServer;
5+
global using Yllibed.HttpServer.Handlers;
6+
global using Yllibed.HttpServer.Defaults;

Yllibed.HttpServer/Handlers/IAuthCallbackHandler.cs renamed to Yllibed.Handlers.Uno/IAuthCallbackHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Yllibed.HttpServer.Handlers;
1+
namespace Yllibed.Handlers.Uno;
22

33
public interface IAuthCallbackHandler : IHttpHandler
44
{

Yllibed.HttpServer/Handlers/OAuthCallbackHandler.cs renamed to Yllibed.Handlers.Uno/OAuthCallbackHandler.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using Microsoft.Extensions.Options;
4-
5-
namespace Yllibed.HttpServer.Handlers;
1+
namespace Yllibed.Handlers.Uno;
62
public record OAuthCallbackHandler : IAuthCallbackHandler
73
{
84
private readonly TaskCompletionSource<WebAuthenticationResult> _tcs = new();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using Microsoft.Extensions.Options;
3+
4+
namespace Yllibed.Handlers.Uno;
5+
public static class ServiceCollectionExtensions
6+
{
7+
public static IServiceCollection AddYllibedAuthCallbackHandler(this IServiceCollection services)
8+
{
9+
services.AddSingleton<OAuthCallbackHandler>();
10+
return services;
11+
}
12+
public static IServiceCollection AddYllibedAuthCallbackHandler<TService>(this IServiceCollection services, Action<AuthCallbackHandlerOptions> configureOptions)
13+
where TService : class, IAuthCallbackHandler
14+
{
15+
services.Configure(configureOptions);
16+
services.AddSingleton<IAuthCallbackHandler, TService>();
17+
return services;
18+
}
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Uno.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net9.0</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<UnoFeatures>
8+
Logging;
9+
Configuration;
10+
</UnoFeatures>
11+
</PropertyGroup>
12+
<ItemGroup Label="Packages">
13+
<!-- <PackageReference Include="Uno.UI"/> TODO: Decide if using PackageReference or Uno.Sdk is able to provide the wanted Low dependency level.-->
14+
</ItemGroup>
15+
<ItemGroup Label="Projects">
16+
<ProjectReference Include="..\Yllibed.HttpServer\Yllibed.HttpServer.csproj" />
17+
</ItemGroup>
18+
</Project>

Yllibed.HttpServer.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<File Path="version.json" />
99
<File Path="Directory.Packages.props" />
1010
</Folder>
11+
<Project Path="Yllibed.Handlers.Uno/Yllibed.Handlers.Uno.csproj" Id="337a3202-2c6c-4f35-8fa2-cb4d98234fb7" />
1112
<Project Path="Yllibed.HttpServer.Json.Tests\Yllibed.HttpServer.Json.Tests.csproj" />
1213
<Project Path="Yllibed.HttpServer.Json\Yllibed.HttpServer.Json.csproj" />
1314
<Project Path="Yllibed.HttpServer.Tests\Yllibed.HttpServer.Tests.csproj" />

0 commit comments

Comments
 (0)