Skip to content

Commit

Permalink
Merge branch 'release/1.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Dec 17, 2023
2 parents 98be8fe + 2ea21f9 commit cce6c8e
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.1.0",
"version": "3.2.0",
"commands": [
"dotnet-cake"
]
Expand Down
14 changes: 7 additions & 7 deletions deployment/cake/installers-squirrel.cake
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public class SquirrelInstaller : IInstaller

if (!BuildContext.CakeContext.FileExists(nuSpecTemplateFileName))
{
BuildContext.CakeContext.Information("Skip packaging of WPF app '{0}' using Squirrel since no Squirrel template is present");
BuildContext.CakeContext.Information($"Skip packaging of WPF app '{projectName}' using Squirrel since no Squirrel template is present");
return;
}

BuildContext.CakeContext.LogSeparator("Packaging WPF app '{0}' using Squirrel", projectName);
BuildContext.CakeContext.LogSeparator($"Packaging WPF app '{projectName}' using Squirrel");

BuildContext.CakeContext.CreateDirectory(squirrelReleasesRoot);
BuildContext.CakeContext.CreateDirectory(squirrelOutputIntermediate);
Expand Down Expand Up @@ -98,7 +98,7 @@ public class SquirrelInstaller : IInstaller
var appSourceDirectory = System.IO.Path.Combine(BuildContext.General.OutputRootDirectory, projectName);
var appTargetDirectory = System.IO.Path.Combine(squirrelOutputIntermediate, "lib");

BuildContext.CakeContext.Information("Copying files from '{0}' => '{1}'", appSourceDirectory, appTargetDirectory);
BuildContext.CakeContext.Information($"Copying files from '{appSourceDirectory}' => '{appTargetDirectory}'");

BuildContext.CakeContext.CopyDirectory(appSourceDirectory, appTargetDirectory);

Expand All @@ -110,7 +110,7 @@ public class SquirrelInstaller : IInstaller
{
var squirrelTargetFile = System.IO.Path.Combine(appTargetDirectory, subDirectory.Segments[subDirectory.Segments.Length - 1], "Squirrel.exe");

BuildContext.CakeContext.Information("Copying Squirrel.exe to support self-updates from '{0}' => '{1}'", squirrelSourceFile, squirrelTargetFile);
BuildContext.CakeContext.Information($"Copying Squirrel.exe to support self-updates from '{squirrelSourceFile}' => '{squirrelTargetFile}'");

BuildContext.CakeContext.CopyFile(squirrelSourceFile, squirrelTargetFile);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public class SquirrelInstaller : IInstaller
var sourcePackageFileName = System.IO.Path.Combine(squirrelOutputIntermediate, $"{projectSlug}{setupSuffix}.{BuildContext.General.Version.NuGet}.nupkg");
var targetPackageFileName = System.IO.Path.Combine(squirrelOutputIntermediate, $"{projectName}.{BuildContext.General.Version.NuGet}.nupkg");

BuildContext.CakeContext.Information("Moving file from '{0}' => '{1}'", sourcePackageFileName, targetPackageFileName);
BuildContext.CakeContext.Information($"Moving file from '{sourcePackageFileName}' => '{targetPackageFileName}'");

BuildContext.CakeContext.MoveFile(sourcePackageFileName, targetPackageFileName);
}
Expand All @@ -157,7 +157,7 @@ public class SquirrelInstaller : IInstaller
BuildContext.CakeContext.CreateDirectory(releasesSourceDirectory);
BuildContext.CakeContext.CreateDirectory(releasesTargetDirectory);

BuildContext.CakeContext.Information("Copying releases from '{0}' => '{1}'", releasesSourceDirectory, releasesTargetDirectory);
BuildContext.CakeContext.Information($"Copying releases from '{releasesSourceDirectory}' => '{releasesTargetDirectory}'");

BuildContext.CakeContext.CopyDirectory(releasesSourceDirectory, releasesTargetDirectory);

Expand Down Expand Up @@ -185,7 +185,7 @@ public class SquirrelInstaller : IInstaller

if (BuildContext.Wpf.UpdateDeploymentsShare)
{
BuildContext.CakeContext.Information("Copying updated Squirrel files back to deployments share at '{0}'", releasesSourceDirectory);
BuildContext.CakeContext.Information($"Copying updated Squirrel files back to deployments share at '{releasesSourceDirectory}'");

// Copy the following files:
// - [version]-full.nupkg
Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/issuetrackers-github.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#tool "nuget:?package=gitreleasemanager&version=0.15.0"
#tool "nuget:?package=gitreleasemanager&version=0.16.0"

//-------------------------------------------------------------

Expand Down
13 changes: 9 additions & 4 deletions deployment/cake/lib-msbuild.cake
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ private static void RunMsBuild(BuildContext buildContext, string projectName, st
buildContext.CakeContext.Information(string.Empty);
buildContext.CakeContext.Information($"Done {action}ing project, took '{buildStopwatch.Elapsed}'");
buildContext.CakeContext.Information(string.Empty);
buildContext.CakeContext.Information($"Investigating potential issues using '{logPath}'");
buildContext.CakeContext.Information(string.Empty);

if (System.IO.File.Exists(logPath))
if (buildContext.General.EnableMsBuildXmlLog &&
System.IO.File.Exists(logPath))
{
buildContext.CakeContext.Information($"Investigating potential issues using '{logPath}'");
buildContext.CakeContext.Information(string.Empty);

var investigationStopwatch = Stopwatch.StartNew();

var issuesContext = buildContext.CakeContext.MsBuildIssuesFromFilePath(logPath, buildContext.CakeContext.MsBuildXmlFileLoggerFormat());
Expand Down Expand Up @@ -301,9 +303,12 @@ private static void RunMsBuild(BuildContext buildContext, string projectName, st

failBuild = true;
}

buildContext.CakeContext.Information(string.Empty);
buildContext.CakeContext.Information($"Done investigating project, took '{investigationStopwatch.Elapsed}'");
buildContext.CakeContext.Information(string.Empty);
}

buildContext.CakeContext.Information(string.Empty);
buildContext.CakeContext.Information($"Done investigating project, took '{investigationStopwatch.Elapsed}'");
buildContext.CakeContext.Information($"Total msbuild ({action} + investigation) took '{totalStopwatch.Elapsed}'");
buildContext.CakeContext.Information(string.Empty);
Expand Down
2 changes: 1 addition & 1 deletion deployment/cake/tasks.cake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// It probably means the tool is not correctly installed.
// `dotnet tool install --global dotnet-sonarscanner --ignore-failed-sources`
//#tool "nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.8.0"
#tool "nuget:?package=dotnet-sonarscanner&version=5.14.0"
#tool "nuget:?package=dotnet-sonarscanner&version=6.0.0"

//-------------------------------------------------------------
// BACKWARDS COMPATIBILITY CODE - START
Expand Down
2 changes: 1 addition & 1 deletion deployment/tye/backend-tye.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: openidconnect
network: openidconnect-network
services:
- name: openidconnect-keycloak
image: quay.io/keycloak/keycloak:22.0.5
image: quay.io/keycloak/keycloak:23.0.2
args: start-dev
bindings:
- port: 5002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.*" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.*" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="2.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.*" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Blorc.OpenIdConnect.Tests/Blorc.OpenIdConnect.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<AssemblyName>Blorc.OpenIdConnect.Tests</AssemblyName>
Expand All @@ -20,15 +20,15 @@
<PackageReference Include="Keycloak.Net" Version="1.0.18" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="ModuleInit.Fody" Version="2.1.1" PrivateAssets="all" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="NUnit" Version="3.14.0" PrivateAssets="all" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NUnit" Version="4.0.1" PrivateAssets="all" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit.DeepObjectCompare" Version="2.0.1" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" PrivateAssets="all" />
<PackageReference Include="Verify.NUnit" Version="22.4.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" PrivateAssets="all" />
<PackageReference Include="Verify.NUnit" Version="22.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ public void Collects_Roles_AsClaims()

var claims = user.AsClaims().Where(claim => claim.Type == ClaimTypes.Role).ToList();

Assert.IsNotEmpty(claims);
Assert.That(claims, Is.Not.Empty);

foreach (var role in user.Profile.Roles)
{
var claim = claims.FirstOrDefault(c => c.Value == role);
Assert.IsNotNull(claim);
Assert.That(claim, Is.Not.Null);
}
}

Expand Down Expand Up @@ -69,7 +70,7 @@ public void Collects_Claims_From_Each_Item_Of_A_Collection()

var claims = users.AsClaims().ToList();

Assert.AreEqual(14, claims.Count);
Assert.That(claims.Count, Is.EqualTo(14));
}

[Test]
Expand Down Expand Up @@ -111,7 +112,7 @@ public void Collects_Claims_From_Complex_Type()

var claims = complexType.AsClaims().ToList();

Assert.AreEqual(18, claims.Count);
Assert.That(claims.Count, Is.EqualTo(18));
}

public class ComplexType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class IsPrimitiveEx_Method
[TestCase(typeof(Profile), false)]
public void Returns_The_Expected_Value(Type type, bool result)
{
Assert.AreEqual(result, type.IsPrimitiveEx());
Assert.That(type.IsPrimitiveEx(), Is.EqualTo(result));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ namespace Blorc.OpenIdConnect
public event System.EventHandler<Blorc.OpenIdConnect.UserActivityEventArgs>? UserActivity;
public event System.EventHandler<Blorc.OpenIdConnect.UserInactivityEventArgs>? UserInactivity;
public virtual void Dispose() { }
protected virtual System.Collections.Generic.IReadOnlyList<string> GetExpectedParameters() { }
public virtual System.Threading.Tasks.Task<TUser?> GetUserAsync<TUser>(bool reload = true, System.Text.Json.JsonSerializerOptions? options = null) { }
public virtual System.Threading.Tasks.Task<TUser?> GetUserAsync<TUser>(System.Threading.Tasks.Task<Microsoft.AspNetCore.Components.Authorization.AuthenticationState> authenticationStateTask, System.Text.Json.JsonSerializerOptions? options = null) { }
protected virtual System.Threading.Tasks.Task<System.Text.Json.JsonElement?> GetUserJsonElementAsync() { }
Expand Down
4 changes: 2 additions & 2 deletions src/Blorc.OpenIdConnect.Tests/Services/UserManagerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task Returns_An_Instance_Of_The_Specified_User_Type_Async()

var user = await userManager.GetUserAsync<User<Profile>>();

Assert.IsNotNull(user);
Assert.That(user, Is.Not.Null);
}

[Test]
Expand Down Expand Up @@ -150,7 +150,7 @@ public async Task Calls_NavigationManager_With_An_Url_Without_Token_Information_

_ = await userManager.GetUserAsync<User<Profile>>();

Assert.AreEqual("http://localhost:5001/fetchdata", navigateUri);
Assert.That(navigateUri, Is.EqualTo("http://localhost:5001/fetchdata"));
}
}

Expand Down
20 changes: 18 additions & 2 deletions src/Blorc.OpenIdConnect/Services/UserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ public class UserManager : IUserManager
{
private readonly OidcProviderOptions _options;

private static readonly string[] ExpectedParameters = { "state", "session_state", "code", "access_token", "id_token", "token_type" };
private static readonly string[] ExpectedParameters =
{
"state",
"session_state",
"code",
"access_token",
"id_token",
"token_type",
"iss"
};

private readonly ILogger<UserManager> _logger;
private readonly IJSRuntime _jsRuntime;
Expand Down Expand Up @@ -48,6 +57,11 @@ public UserManager(ILogger<UserManager> logger, IJSRuntime jsRuntime, Navigation

public event EventHandler<UserInactivityEventArgs>? UserInactivity;

protected virtual IReadOnlyList<string> GetExpectedParameters()
{
return ExpectedParameters;
}

public virtual async Task<TUser?> GetUserAsync<TUser>(Task<AuthenticationState> authenticationStateTask, JsonSerializerOptions? options = null)
{
var authenticationState = await authenticationStateTask;
Expand Down Expand Up @@ -220,9 +234,11 @@ public virtual void Dispose()
.Select(assignments => (Name: assignments[0], Value: assignments[1]))
.ToList();

var expectedParameters = GetExpectedParameters();

for (var i = parameters.Count - 1; i >= 0; i--)
{
if (ExpectedParameters.Contains(parameters[i].Name, StringComparer.InvariantCultureIgnoreCase))
if (expectedParameters.Contains(parameters[i].Name, StringComparer.InvariantCultureIgnoreCase))
{
parameters.RemoveAt(i);
redirectRequired = true;
Expand Down
24 changes: 20 additions & 4 deletions src/Directory.Build.analyzers.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
-->

<ItemGroup>
<PackageReference Include="Catel.Analyzers" Version="1.6.1" PrivateAssets="all" />
<PackageReference Include="CatenaLogic.Analyzers" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="IDisposableAnalyzers" Version="4.0.6" PrivateAssets="all" />
<PackageReference Include="WpfAnalyzers" Version="4.1.1" PrivateAssets="all" />
<PackageReference Include="Catel.Analyzers" Version="1.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CatenaLogic.Analyzers" Version="1.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="WpfAnalyzers" Version="4.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
Expand Down
24 changes: 24 additions & 0 deletions src/Directory.Build.shared.explicit.props
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,30 @@
<Page Include="Platforms\net\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Compile Update="Platforms\net\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
</ItemGroup>

<!-- .NET 9.0 -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net9.0')) ">
<DefineConstants>$(DefineConstants);NETCORE;NETCORE9;NETCORE9_0;NET9;NET9_0</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net9.0')) ">
<None Remove="Platforms\net\**\*.cs;Platforms\net\**\*.xaml;Platforms\net\**\*.xaml.cs" />
<Compile Include="Platforms\net\**\*.cs" DependentUpon="%(Filename)" />
<Page Include="Platforms\net\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Compile Update="Platforms\net\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
</ItemGroup>

<!-- .NET 10.0 -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net10.0')) ">
<DefineConstants>$(DefineConstants);NETCORE;NETCORE10;NETCORE10_0;NET10;NET10_0</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net10.0')) ">
<None Remove="Platforms\net\**\*.cs;Platforms\net\**\*.xaml;Platforms\net\**\*.xaml.cs" />
<Compile Include="Platforms\net\**\*.cs" DependentUpon="%(Filename)" />
<Page Include="Platforms\net\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Compile Update="Platforms\net\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
</ItemGroup>

<!-- .NET Standard 2.0 -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
Expand Down
4 changes: 4 additions & 0 deletions src/nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<add key="Local packages" value="C:\Source\_packages" />
</packageSources>

<disabledPackageSources>
<add key="Local packages" value="true" />
</disabledPackageSources>

<!-- key value for <packageSource> should match key values from <packageSources> element -->
<packageSourceMapping>
<packageSource key="nuget.org">
Expand Down

0 comments on commit cce6c8e

Please sign in to comment.