diff --git a/Directory.Packages.props b/Directory.Packages.props
index f9f7ca81..0e634cbc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -32,8 +32,10 @@
+
-
+
+
@@ -42,7 +44,10 @@
+
+
+
diff --git a/README.md b/README.md
index b12e668a..5e164d65 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ This repository contains samples demonstrating **how to use [OpenIddict](https:/
- [Sorgan](samples/Sorgan): Windows Forms, Windows Presentation Foundation and Blazor Hybrid clients using GitHub for user authentication.
## OWIN/ASP.NET 4.8 samples
- - [Fornax](samples/Fornax): authorization code flow demo using ASP.NET Web Forms 4.8 and OWIN/Katana, with a .NET console acting as the client.
+ - [Fornax](samples/Fornax): authorization code flow demo using ASP.NET Web Forms 4.8 and OWIN/Katana, with a .NET Framework 4.8 console acting as the client.
- [Mortis](samples/Mortis): authorization code flow demo, with an ASP.NET MVC 5.2 application acting as the client.
- [Kalarba](samples/Kalarba): resource owner password credentials demo using OWIN/Katana, ASP.NET Web API and the OpenIddict degraded mode.
diff --git a/samples/Fornax/Fornax.Client/Fornax.Client.csproj b/samples/Fornax/Fornax.Client/Fornax.Client.csproj
index efd2c884..0c806e9e 100644
--- a/samples/Fornax/Fornax.Client/Fornax.Client.csproj
+++ b/samples/Fornax/Fornax.Client/Fornax.Client.csproj
@@ -2,13 +2,13 @@
Exe
- net8.0
- true
+ net48
+
diff --git a/samples/Fornax/Fornax.Client/InteractiveService.cs b/samples/Fornax/Fornax.Client/InteractiveService.cs
index 693fe567..71739222 100644
--- a/samples/Fornax/Fornax.Client/InteractiveService.cs
+++ b/samples/Fornax/Fornax.Client/InteractiveService.cs
@@ -10,11 +10,11 @@ namespace Fornax.Client;
public class InteractiveService : BackgroundService
{
- private readonly IHostApplicationLifetime _lifetime;
+ private readonly IApplicationLifetime _lifetime;
private readonly OpenIddictClientService _service;
public InteractiveService(
- IHostApplicationLifetime lifetime,
+ IApplicationLifetime lifetime,
OpenIddictClientService service)
{
_lifetime = lifetime;
@@ -31,7 +31,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
}
Console.WriteLine("Press any key to start the authentication process.");
- await Task.Run(Console.ReadKey).WaitAsync(stoppingToken);
+ await WaitAsync(Task.Run(Console.ReadKey, stoppingToken), stoppingToken);
try
{
@@ -76,5 +76,20 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Console.WriteLine("An error occurred while trying to authenticate the user.");
}
+
+ static async Task WaitAsync(Task task, CancellationToken cancellationToken)
+ {
+ var source = new TaskCompletionSource(TaskCreationOptions.None);
+
+ using (cancellationToken.Register(static state => ((TaskCompletionSource) state!).SetResult(true), source))
+ {
+ if (await Task.WhenAny(task, source.Task) == source.Task)
+ {
+ throw new OperationCanceledException(cancellationToken);
+ }
+
+ return await task;
+ }
+ }
}
}
diff --git a/samples/Fornax/Fornax.Client/Program.cs b/samples/Fornax/Fornax.Client/Program.cs
index ab7c19cc..e7a9d489 100644
--- a/samples/Fornax/Fornax.Client/Program.cs
+++ b/samples/Fornax/Fornax.Client/Program.cs
@@ -43,7 +43,7 @@
// Add the operating system integration.
options.UseSystemIntegration()
- .SetAllowedEmbeddedWebServerPorts(7891);
+ .SetApplicationDiscriminator("4N494SXGMTWQLZE");
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
@@ -57,7 +57,7 @@
Issuer = new Uri("https://localhost:44387/", UriKind.Absolute),
ClientId = "console_app",
- RedirectUri = new Uri("http://localhost:7891/", UriKind.Absolute)
+ RedirectUri = new Uri("/", UriKind.Relative)
});
});
@@ -69,6 +69,9 @@
// Register the background service responsible for handling the console interactions.
services.AddHostedService();
+
+ // Prevent the console lifetime manager from writing status messages to the output stream.
+ services.Configure(options => options.SuppressStatusMessages = true);
})
.UseConsoleLifetime()
.Build();
diff --git a/samples/Fornax/Fornax.Server/Global.asax.cs b/samples/Fornax/Fornax.Server/Global.asax.cs
index 9605cec7..2ab8a6b6 100644
--- a/samples/Fornax/Fornax.Server/Global.asax.cs
+++ b/samples/Fornax/Fornax.Server/Global.asax.cs
@@ -98,12 +98,14 @@ void Application_Start(object sender, EventArgs e)
{
await manager.CreateAsync(new OpenIddictApplicationDescriptor
{
+ ApplicationType = ApplicationTypes.Native,
ClientId = "console_app",
+ ClientType = ClientTypes.Public,
ConsentType = ConsentTypes.Explicit,
DisplayName = "Console application",
RedirectUris =
{
- new Uri("http://localhost:7891/")
+ new Uri("http://localhost/")
},
Permissions =
{
diff --git a/samples/Fornax/Fornax.Server/Web.config b/samples/Fornax/Fornax.Server/Web.config
index 2e50a021..c2238826 100644
--- a/samples/Fornax/Fornax.Server/Web.config
+++ b/samples/Fornax/Fornax.Server/Web.config
@@ -9,7 +9,7 @@
-
+
diff --git a/samples/Matty/Matty.Client/Matty.Client.csproj b/samples/Matty/Matty.Client/Matty.Client.csproj
index a69600fe..19e3bec0 100644
--- a/samples/Matty/Matty.Client/Matty.Client.csproj
+++ b/samples/Matty/Matty.Client/Matty.Client.csproj
@@ -3,7 +3,6 @@
Exe
net8.0
- true
diff --git a/samples/Mimban/Mimban.Client/Mimban.Client.csproj b/samples/Mimban/Mimban.Client/Mimban.Client.csproj
index 6643e42d..f9e9dcb9 100644
--- a/samples/Mimban/Mimban.Client/Mimban.Client.csproj
+++ b/samples/Mimban/Mimban.Client/Mimban.Client.csproj
@@ -3,7 +3,6 @@
Exe
net8.0
- true
diff --git a/samples/Mimban/Mimban.Client/Program.cs b/samples/Mimban/Mimban.Client/Program.cs
index 0b416035..31031e0f 100644
--- a/samples/Mimban/Mimban.Client/Program.cs
+++ b/samples/Mimban/Mimban.Client/Program.cs
@@ -42,8 +42,7 @@
.AddDevelopmentSigningCertificate();
// Add the operating system integration.
- options.UseSystemIntegration()
- .SetAllowedEmbeddedWebServerPorts(8914);
+ options.UseSystemIntegration();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
@@ -57,7 +56,7 @@
Issuer = new Uri("https://localhost:44383/", UriKind.Absolute),
ClientId = "console_app",
- RedirectUri = new Uri("http://localhost:8914/", UriKind.Absolute)
+ RedirectUri = new Uri("/", UriKind.Relative)
});
});
diff --git a/samples/Mimban/Mimban.Server/Program.cs b/samples/Mimban/Mimban.Server/Program.cs
index b7fb37bd..d1727220 100644
--- a/samples/Mimban/Mimban.Server/Program.cs
+++ b/samples/Mimban/Mimban.Server/Program.cs
@@ -134,10 +134,12 @@
{
await manager.CreateAsync(new OpenIddictApplicationDescriptor
{
+ ApplicationType = ApplicationTypes.Native,
ClientId = "console_app",
+ ClientType = ClientTypes.Public,
RedirectUris =
{
- new Uri("http://localhost:8914/")
+ new Uri("http://localhost/")
},
Permissions =
{
diff --git a/samples/Weytta/Weytta.Client/Program.cs b/samples/Weytta/Weytta.Client/Program.cs
index 144924b6..a6872f13 100644
--- a/samples/Weytta/Weytta.Client/Program.cs
+++ b/samples/Weytta/Weytta.Client/Program.cs
@@ -42,8 +42,7 @@
.AddDevelopmentSigningCertificate();
// Add the operating system integration.
- options.UseSystemIntegration()
- .SetAllowedEmbeddedWebServerPorts(7890);
+ options.UseSystemIntegration();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
@@ -57,7 +56,7 @@
Issuer = new Uri("https://localhost:44319/", UriKind.Absolute),
ClientId = "console_app",
- RedirectUri = new Uri("http://localhost:7890/", UriKind.Absolute)
+ RedirectUri = new Uri("/", UriKind.Relative)
});
});
diff --git a/samples/Weytta/Weytta.Client/Weytta.Client.csproj b/samples/Weytta/Weytta.Client/Weytta.Client.csproj
index efd2c884..5af4dc09 100644
--- a/samples/Weytta/Weytta.Client/Weytta.Client.csproj
+++ b/samples/Weytta/Weytta.Client/Weytta.Client.csproj
@@ -3,7 +3,6 @@
Exe
net8.0
- true
diff --git a/samples/Weytta/Weytta.Server/Worker.cs b/samples/Weytta/Weytta.Server/Worker.cs
index d614e15d..6aa72979 100644
--- a/samples/Weytta/Weytta.Server/Worker.cs
+++ b/samples/Weytta/Weytta.Server/Worker.cs
@@ -29,12 +29,14 @@ public async Task StartAsync(CancellationToken cancellationToken)
{
await manager.CreateAsync(new OpenIddictApplicationDescriptor
{
+ ApplicationType = ApplicationTypes.Native,
ClientId = "console_app",
+ ClientType = ClientTypes.Public,
ConsentType = ConsentTypes.Implicit,
DisplayName = "Console application",
RedirectUris =
{
- new Uri("http://localhost:7890/")
+ new Uri("http://localhost/")
},
Permissions =
{
diff --git a/samples/Zirku/Zirku.Client1/Program.cs b/samples/Zirku/Zirku.Client1/Program.cs
index 166f8240..14cdf66b 100644
--- a/samples/Zirku/Zirku.Client1/Program.cs
+++ b/samples/Zirku/Zirku.Client1/Program.cs
@@ -43,8 +43,7 @@
.AddDevelopmentSigningCertificate();
// Add the operating system integration.
- options.UseSystemIntegration()
- .SetAllowedEmbeddedWebServerPorts(8739);
+ options.UseSystemIntegration();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
@@ -58,7 +57,7 @@
Issuer = new Uri("https://localhost:44319/", UriKind.Absolute),
ClientId = "console_app",
- RedirectUri = new Uri("http://localhost:8739/", UriKind.Absolute),
+ RedirectUri = new Uri("/", UriKind.Relative),
Scopes = { Scopes.OpenId, "api1", "api2" }
});
});
diff --git a/samples/Zirku/Zirku.Client1/Zirku.Client1.csproj b/samples/Zirku/Zirku.Client1/Zirku.Client1.csproj
index efd2c884..5af4dc09 100644
--- a/samples/Zirku/Zirku.Client1/Zirku.Client1.csproj
+++ b/samples/Zirku/Zirku.Client1/Zirku.Client1.csproj
@@ -3,7 +3,6 @@
Exe
net8.0
- true
diff --git a/samples/Zirku/Zirku.Server/Program.cs b/samples/Zirku/Zirku.Server/Program.cs
index af538a69..66538116 100644
--- a/samples/Zirku/Zirku.Server/Program.cs
+++ b/samples/Zirku/Zirku.Server/Program.cs
@@ -126,10 +126,12 @@ async Task CreateApplicationsAsync()
{
await manager.CreateAsync(new OpenIddictApplicationDescriptor
{
+ ApplicationType = ApplicationTypes.Native,
ClientId = "console_app",
+ ClientType = ClientTypes.Public,
RedirectUris =
{
- new Uri("http://localhost:8739/")
+ new Uri("http://localhost/")
},
Permissions =
{