Skip to content

Commit

Permalink
Make WindowsConsoleSystemBrowser target net8.0 and get compiling.
Browse files Browse the repository at this point in the history
The registry methods needed be decorated with SupportedOSPlatform to compile.
  • Loading branch information
damianh authored and josephdecock committed Feb 11, 2025
1 parent 7e4f887 commit 081038a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.0.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(WilsonVersion)" />
<PackageVersion Include="Microsoft.IdentityModel.Logging" Version="$(WilsonVersion)" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(WilsonVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="Microsoft.NETCore.Jit" Version="2.0.8" />
Expand All @@ -91,6 +92,7 @@
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.TextWriter" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.XUnit" Version="3.0.19" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Clients;
using Clients;
using Duende.IdentityModel.Client;
using Duende.IdentityModel.OidcClient;
using Microsoft.IdentityModel.Logging;
Expand All @@ -8,10 +8,12 @@
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;

namespace WindowsConsoleSystemBrowser
{
[SupportedOSPlatform("Windows")]
class Program
{
static async Task Main(string[] args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System;
using System.Reflection;
using System.Runtime.Versioning;
using Microsoft.Win32;

namespace WindowsConsoleSystemBrowser
{
[SupportedOSPlatform("Windows")]
class RegistryConfig
{
public RegistryConfig(string uriScheme)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Duende.IdentityModel.OidcClient" />

<PackageReference Include="Microsoft.IdentityModel.Logging"/>
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Sinks.Console" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// See LICENSE in the project root for license information.


using Duende.IdentityModel.Client;
using Duende.IdentityServer;
using Duende.IdentityServer.Extensions;
using Duende.IdentityServer.Models;
using Duende.IdentityServer.Services;
using Duende.IdentityServer.Stores;
using Duende.IdentityServer.Test;
using Shouldly;
using IntegrationTests.Common;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using Duende.IdentityModel.Client;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.AspNetCore.Authentication.Cookies;
using Duende.IdentityServer;
using Microsoft.AspNetCore.DataProtection;
using Duende.IdentityServer.Extensions;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;

namespace IntegrationTests.Hosting;

Expand Down Expand Up @@ -503,18 +502,18 @@ public async Task request_to_identity_server_with_expired_session_which_has_not_
var jwt = form.Substring("login_token=".Length + 1);
var handler = new JsonWebTokenHandler();
var token = handler.ReadJsonWebToken(jwt);
token.Issuer.Should().Be(IdentityServerPipeline.BaseUrl);
token.GetClaim("sub").Value.Should().Be("alice");
token.Issuer.ShouldBe(IdentityServerPipeline.BaseUrl);
token.GetClaim("sub").Value.ShouldBe("alice");
};
_pipeline.BackChannelMessageHandler.InvokeWasCalled.Should().BeFalse();
_pipeline.BackChannelMessageHandler.InvokeWasCalled.ShouldBeFalse();

var session = (await _sessionStore.GetSessionsAsync(new SessionFilter { SubjectId = "alice" })).Single();
session.Expires = System.DateTime.UtcNow.AddMinutes(-1);
await _sessionStore.UpdateSessionAsync(session);

await _pipeline.RequestAuthorizationEndpointAsync("client", "code", "openid api offline_access", "https://client/callback");

_pipeline.BackChannelMessageHandler.InvokeWasCalled.Should().BeTrue();
_pipeline.BackChannelMessageHandler.InvokeWasCalled.ShouldBeTrue();
}

[Fact]
Expand Down

0 comments on commit 081038a

Please sign in to comment.