Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/Build_&_Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
# [GithubActionsExtended (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
Expand All @@ -31,7 +31,17 @@ jobs:
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9'
dotnet-version: |
8.0
9.0
10.0
- uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Test'
run: ./build.cmd Test
14 changes: 12 additions & 2 deletions .github/workflows/Manual_Nuget_Push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
# [GithubActionsExtended (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
Expand All @@ -25,8 +25,18 @@ jobs:
steps:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9'
dotnet-version: |
8.0
9.0
10.0
- uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: NugetPush'
run: ./build.cmd NugetPush
env:
Expand Down
18 changes: 8 additions & 10 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@
using static Nuke.Common.Tools.DotNet.DotNetTasks;


[GitHubActions(
[GithubActionsExtended(
"Build & Test",
GitHubActionsImage.UbuntuLatest,
OnPushBranches = new []{ "main" },
OnPullRequestBranches = new []{ "main" },
InvokedTargets = new[] { nameof(Test) },
AutoGenerate = false)]
[GitHubActions(
OnPushBranches = ["main"],
OnPullRequestBranches = ["main"],
InvokedTargets = [nameof(Test)])]
[GithubActionsExtended(
"Manual Nuget Push",
GitHubActionsImage.UbuntuLatest,
On = new[] { GitHubActionsTrigger.WorkflowDispatch },
InvokedTargets = new[] { nameof(NugetPush) },
ImportSecrets = new[] { nameof(NugetApiKey) },
AutoGenerate = false)]
On = [GitHubActionsTrigger.WorkflowDispatch],
InvokedTargets = [nameof(NugetPush)],
ImportSecrets = [nameof(NugetApiKey)])]
class Build : NukeBuild
{
/// Support plugins are available for:
Expand Down
58 changes: 58 additions & 0 deletions build/GithubActionsExtendedAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Collections.Generic;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.CI.GitHubActions.Configuration;
using Nuke.Common.Execution;
using Nuke.Common.Utilities;

public class GitHubActionsSetupDotNetStep : GitHubActionsStep
{
public GitHubActionsSetupDotNetStep(string[] versions)
{
Versions = versions;
}

string[] Versions { get; }

public override void Write(CustomFileWriter writer)
{
writer.WriteLine("- uses: actions/setup-dotnet@v4");

using (writer.Indent())
{
writer.WriteLine("with:");
using (writer.Indent())
{
writer.WriteLine("dotnet-version: |");
using (writer.Indent())
{
foreach (var version in Versions)
{
writer.WriteLine(version);
}
}
}
}
}
}

public class GithubActionsExtendedAttribute : GitHubActionsAttribute
{
public GithubActionsExtendedAttribute(string name, GitHubActionsImage image, params GitHubActionsImage[] images) : base(name, image, images)
{
}

protected override GitHubActionsJob GetJobs(GitHubActionsImage image,
IReadOnlyCollection<ExecutableTarget> relevantTargets)
{
var job = base.GetJobs(image, relevantTargets);

var newSteps = new List<GitHubActionsStep>(job.Steps);
newSteps.Insert(0, new GitHubActionsSetupDotNetStep([
"8.0", "9.0", "10.0"
]));

job.Steps = newSteps.ToArray();

return job;
}
}
12 changes: 7 additions & 5 deletions src/Auth0Net.DependencyInjection/Auth0Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ private static IHttpClientBuilder AddAuth0AuthenticationClientInternal(this ISer

services.AddSingleton<IAuthenticationApiClient, InjectableAuthenticationApiClient>();
return services.AddHttpClient<IAuthenticationConnection, HttpClientAuthenticationConnection>()
#if !NETFRAMEWORK
// TODO drop this code with the release of .NET 10
#if NET8_0
.ConfigurePrimaryHttpMessageHandler(() =>
new SocketsHttpHandler()
{
PooledConnectionLifetime = TimeSpan.FromMinutes(2)
})
.SetHandlerLifetime(Timeout.InfiniteTimeSpan)
#endif
.SetHandlerLifetime(Timeout.InfiniteTimeSpan);
;

}


Expand All @@ -117,14 +118,15 @@ public static IHttpClientBuilder AddAuth0ManagementClient(this IServiceCollectio
services.AddSingleton<IManagementApiClient, InjectableManagementApiClient>();

return services.AddHttpClient<IManagementConnection, HttpClientManagementConnection>()
#if !NETFRAMEWORK
#if NET8_0
.ConfigurePrimaryHttpMessageHandler(() =>
new SocketsHttpHandler()
{
PooledConnectionLifetime = TimeSpan.FromMinutes(2)
})
.SetHandlerLifetime(Timeout.InfiniteTimeSpan)
#endif
.SetHandlerLifetime(Timeout.InfiniteTimeSpan);
;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net48;net8.0;net9.0;net10.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>5.1.0</Version>
<Version>5.2.0</Version>
<Authors>Hawxy</Authors>
<Description>Dependency Injection, HttpClientFactory &amp; ASP.NET Core extensions for Auth0.NET</Description>
<LangVersion>latest</LangVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Copyright>Hawxy (JT) 2020-2025</Copyright>
<Copyright>Hawxy (JT) 2020-2026</Copyright>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Hawxy/Auth0Net.DependencyInjection</PackageProjectUrl>
Expand All @@ -21,29 +21,38 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Auth0.AuthenticationApi" Version="7.36.0" />
<PackageReference Include="Auth0.ManagementApi" Version="7.36.0" />
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.2.25" PrivateAssets="All" />
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
<PackageReference Include="Auth0.AuthenticationApi" Version="7.42.0" />
<PackageReference Include="Auth0.ManagementApi" Version="7.42.0" />
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.2.39" PrivateAssets="All" />
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.4.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.1" />
<PackageReference Include="Polyfill" Version="7.31.0" PrivateAssets="all" />
<PackageReference Include="Polyfill" Version="9.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.4" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.4.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.4" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.10.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class Auth0ResilienceExtensions
/// <param name="builder">The underlying <see cref="IHttpClientBuilder"/></param>
/// <param name="maxRetryAttempts">The max number of retry attempts to Auth0. Defaults to 10.</param>
/// <returns></returns>
public static IHttpResiliencePipelineBuilder AddAuth0RateLimitResilience(this IHttpClientBuilder builder, int maxRetryAttempts = 10)
public static IHttpResiliencePipelineBuilder AddAuth0RateLimitResilience(this IHttpClientBuilder builder, int maxRetryAttempts = 4)
{
return builder.AddResilienceHandler("RateLimitRetry",
pipelineBuilder =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FakeItEasy" Version="8.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit.v3" Version="2.0.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit.v3" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading