Skip to content

Commit 4f249bd

Browse files
authored
v2.0.0 - .NET 7 + IManagementApi changes (#13)
* .NET 7 + IManagementApi pass * Update main.yml * Update README.md
1 parent 1dbe96a commit 4f249bd

10 files changed

Lines changed: 33 additions & 46 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@ jobs:
1515
- uses: actions/checkout@v2
1616

1717
- name: Setup .NET 6
18-
uses: actions/setup-dotnet@v1
18+
uses: actions/setup-dotnet@v3
1919
with:
2020
dotnet-version: '6.0.x'
2121

22-
- name: Setup .NET 5
23-
uses: actions/setup-dotnet@v1
22+
- name: Setup .NET 7
23+
uses: actions/setup-dotnet@v3
2424
with:
25-
dotnet-version: '5.0.x'
26-
27-
- name: Setup .NET Core 3.1
28-
uses: actions/setup-dotnet@v1
29-
with:
30-
dotnet-version: '3.1.x'
25+
dotnet-version: '7.0.x'
3126

3227
- name: Install dependencies
3328
run: dotnet restore

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Auth0.NET Dependency Injection Extensions
2-
![.NET Core Build & Test](https://github.com/Hawxy/Auth0Net.DependencyInjection/workflows/.NET%20Core%20Build%20&%20Test/badge.svg)
2+
![BuildTest](https://github.com/Hawxy/Auth0Net.DependencyInjection/workflows/.NET%20Core%20Build%20&%20Test/badge.svg)
33
[![NuGet](https://img.shields.io/nuget/v/Auth0Net.DependencyInjection.svg?style=flat-square)](https://www.nuget.org/packages/Auth0Net.DependencyInjection)
4+
[![Nuget](https://img.shields.io/nuget/dt/Auth0Net.DependencyInjection?style=flat-square)](https://www.nuget.org/packages/Auth0Net.DependencyInjection)
45

56
<h1 align="center">
67
<img align="center" src="https://user-images.githubusercontent.com/975824/128343470-8d97e39d-ff8a-4daf-8ebf-f9039a46abd6.png" height="130px" />
@@ -18,7 +19,7 @@ This library hopes to solve that problem, featuring:
1819

1920
:white_check_mark: `IHttpClientBuilder` extensions, providing handlers to automatically append access tokens to outgoing requests.
2021

21-
This library supports .NET Core 3.1, .NET 5 & .NET 6, and is suitable for use in ASP.NET Core and standalone .NET Generic Host applications.
22+
This library supports .NET 6 & .NET 7, and is suitable for use in ASP.NET Core and standalone .NET Generic Host applications.
2223

2324
## Install
2425

@@ -78,15 +79,15 @@ services.AddAuth0ManagementClient().AddManagementAccessToken();
7879

7980
Ensure your Machine-to-Machine application is authorized to request tokens from the Managment API and it has the correct scopes for the features you wish to use.
8081

81-
You can then request the `ManagementApiClient` (or `IAuthenticationApiClient`) within your services:
82+
You can then request the `IManagementApiClient` (or `IAuthenticationApiClient`) within your services:
8283

8384
```csharp
8485

8586
public class MyAuth0Service : IAuth0Service
8687
{
87-
private readonly ManagementApiClient _managementApiClient;
88+
private readonly IManagementApiClient _managementApiClient;
8889

89-
public AuthController(ManagementApiClient managementApiClient)
90+
public AuthController(IManagementApiClient managementApiClient)
9091
{
9192
_managementApiClient = managementApiClient;
9293
}

samples/Sample.AspNetCore/Controllers/UsersController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace Sample.AspNetCore.Controllers
1111
[Route("[controller]")]
1212
public class UsersController : ControllerBase
1313
{
14-
private readonly ManagementApiClient _managementApiClient;
14+
private readonly IManagementApiClient _managementApiClient;
1515

16-
public UsersController(ManagementApiClient managementApiClient)
16+
public UsersController(IManagementApiClient managementApiClient)
1717
{
1818
_managementApiClient = managementApiClient;
1919
}

samples/Sample.AspNetCore/Protos/UsersService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace Sample.AspNetCore.Protos
1010
{
1111
public class UsersService : UserService.UserServiceBase
1212
{
13-
private readonly ManagementApiClient _client;
14-
public UsersService(ManagementApiClient client)
13+
private readonly IManagementApiClient _client;
14+
public UsersService(IManagementApiClient client)
1515
{
1616
_client = client;
1717
}

samples/Sample.AspNetCore/Sample.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Grpc.AspNetCore" Version="2.48.0" />
10+
<PackageReference Include="Grpc.AspNetCore" Version="2.49.0" />
1111
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" />
1212
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
1313
</ItemGroup>

samples/Sample.ConsoleApp/Sample.ConsoleApp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<PackageReference Include="Google.Protobuf" Version="3.21.5" />
24-
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.48.0" />
25-
<PackageReference Include="Grpc.Tools" Version="2.48.0">
23+
<PackageReference Include="Google.Protobuf" Version="3.21.9" />
24+
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.49.0" />
25+
<PackageReference Include="Grpc.Tools" Version="2.50.0">
2626
<PrivateAssets>all</PrivateAssets>
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
</PackageReference>

src/Auth0Net.DependencyInjection/Auth0Extensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Auth0Net.DependencyInjection.Cache;
77
using Auth0Net.DependencyInjection.HttpClient;
88
using Auth0Net.DependencyInjection.Injectables;
9-
using Microsoft.Extensions.DependencyInjection.Extensions;
109
using Microsoft.Extensions.Options;
1110

1211
// ReSharper disable once CheckNamespace
@@ -77,8 +76,7 @@ public static IHttpClientBuilder AddAuth0AuthenticationClient(this IServiceColle
7776
/// <returns>An <see cref="IHttpClientBuilder" /> that can be used to configure the <see cref="HttpClientManagementConnection"/>.</returns>
7877
public static IHttpClientBuilder AddAuth0ManagementClient(this IServiceCollection services)
7978
{
80-
services.AddScoped<InjectableManagementApiClient>();
81-
services.AddScoped<ManagementApiClient>(resolver => resolver.GetRequiredService<InjectableManagementApiClient>());
79+
services.AddScoped<IManagementApiClient, InjectableManagementApiClient>();
8280

8381
return services.AddHttpClient<IManagementConnection, HttpClientManagementConnection>();
8482
}

src/Auth0Net.DependencyInjection/Auth0Net.DependencyInjection.csproj

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Nullable>enable</Nullable>
7-
<Version>1.7.0</Version>
7+
<Version>2.0.0</Version>
88
<Authors>Hawxy</Authors>
99
<Description>Dependency Injection, HttpClientFactory &amp; ASP.NET Core extensions for Auth0.NET</Description>
1010
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
11-
<Copyright>Hawxy 2020-2021</Copyright>
11+
<Copyright>Hawxy 2020-2023</Copyright>
1212
<PackageIcon>icon.png</PackageIcon>
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1414
<PackageProjectUrl>https://github.com/Hawxy/Auth0Net.DependencyInjection</PackageProjectUrl>
@@ -18,30 +18,23 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Auth0.AuthenticationApi" Version="7.17.0" />
22-
<PackageReference Include="Auth0.ManagementApi" Version="7.17.0" />
21+
<PackageReference Include="Auth0.AuthenticationApi" Version="7.17.4" />
22+
<PackageReference Include="Auth0.ManagementApi" Version="7.17.4" />
2323
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
2424
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
2525
</ItemGroup>
2626

27-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
28-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.*" />
29-
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.*" />
30-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.*" />
31-
</ItemGroup>
32-
33-
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
34-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
35-
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
36-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
37-
</ItemGroup>
38-
3927
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
4028
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
4129
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
4230
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
4331
</ItemGroup>
4432

33+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
34+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
35+
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
36+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
37+
</ItemGroup>
4538

4639
<ItemGroup>
4740
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">

tests/Auth0Net.DependencyInjection.Tests/Auth0Net.DependencyInjection.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<PackageReference Include="FakeItEasy" Version="7.3.1" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
1212
<PackageReference Include="xunit" Version="2.4.2" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1515
<PrivateAssets>all</PrivateAssets>
1616
</PackageReference>
17-
<PackageReference Include="coverlet.collector" Version="3.1.2">
17+
<PackageReference Include="coverlet.collector" Version="3.2.0">
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
<PrivateAssets>all</PrivateAssets>
2020
</PackageReference>

tests/Auth0Net.DependencyInjection.Tests/ExtensionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void AddManagementClient_Can_BeResolved()
170170

171171
var services = collection.BuildServiceProvider();
172172

173-
var client = services.GetService<ManagementApiClient>();
173+
var client = services.GetService<IManagementApiClient>();
174174

175175
Assert.NotNull(client);
176176
}

0 commit comments

Comments
 (0)