Skip to content

Commit

Permalink
v1.4.1 (#7)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md

* Update README.md

* Dependency update

* Remove deepcode badge

* Suppress snyk vun

* Add icon path

* Bump version
  • Loading branch information
Hawxy authored Aug 5, 2021
1 parent 6dfc88b commit b272972
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 20 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Auth0.NET Dependency Injection Extensions
![.NET Core Build & Test](https://github.com/Hawxy/Auth0Net.DependencyInjection/workflows/.NET%20Core%20Build%20&%20Test/badge.svg)
[![NuGet](https://img.shields.io/nuget/v/Auth0Net.DependencyInjection.svg?style=flat-square)](https://www.nuget.org/packages/Auth0Net.DependencyInjection)
[![deepcode](https://www.deepcode.ai/api/gh/badge?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF0Zm9ybTEiOiJnaCIsIm93bmVyMSI6Ikhhd3h5IiwicmVwbzEiOiJBdXRoME5ldC5EZXBlbmRlbmN5SW5qZWN0aW9uIiwiaW5jbHVkZUxpbnQiOmZhbHNlLCJhdXRob3JJZCI6MjczMDcsImlhdCI6MTYxNjczOTcyNH0.4StSyQGHntE1YwSsXjjvRtfJJRSvyUNn43YWT1_FHkU)](https://www.deepcode.ai/app/gh/Hawxy/Auth0Net.DependencyInjection/_/dashboard?utm_content=gh%2FHawxy%2FAuth0Net.DependencyInjection)

<h1 align="center">
<img align="center" src="src/Auth0Net.DependencyInjection/Images/icon.png" height="130px" />
<img align="center" src="https://user-images.githubusercontent.com/975824/128343470-8d97e39d-ff8a-4daf-8ebf-f9039a46abd6.png" height="130px" />
</h1>

Integrating [Auth0.NET](https://github.com/auth0/auth0.net) into your project whilst attempting to follow idiomatic .NET Core conventions can be cumbersome and involve a sizable amount of boilerplate shared between projects.
Expand Down Expand Up @@ -33,7 +32,7 @@ Install-Package Auth0Net.DependencyInjection

### Authentication Client Only

![Auth0 Authentication](docs/images/Auth0Authentication.png?raw=true)
![Auth0Authentication](https://user-images.githubusercontent.com/975824/128319560-4b859296-44f5-4219-a1b3-8255bf29f1b3.png)

If you're simply using the `AuthenticationApiClient` and nothing else, you can call `AddAuth0AuthenticationClientCore` and pass in your Auth0 Domain. This integration is lightweight and does not support any other features of this library.

Expand All @@ -57,7 +56,8 @@ public class AuthController : ControllerBase

### Authentication Client + Management Client

![Auth0 Authentication & Management](docs/images/Auth0Authentication+Management.png?raw=true)
![Auth0AuthenticationAndManagement](https://user-images.githubusercontent.com/975824/128319611-9083d473-191d-4593-ad0f-9669335dbb62.png)

Add the `AuthenticationApiClient` with `AddAuth0AuthenticationClient`, and provide a [machine-to-machine application](https://auth0.com/docs/applications/set-up-an-application/register-machine-to-machine-applications) configuration that will be consumed by the Management Client, Token Cache and IHttpClientBuilder integrations. This extension **must** be called before using any other extensions within this library:
Expand Down Expand Up @@ -94,7 +94,7 @@ public class MyAuth0Service : IAuth0Service

### With HttpClient and/or Grpc Services

![Auth0 All](docs/images/Auth0All.png?raw=true)
![Auth0AuthenticationAll](https://user-images.githubusercontent.com/975824/128319653-418e0e72-2ddf-4d02-9544-1d60bd523321.png)
**Note:** This feature relies on `services.AddAuth0AuthenticationClient(config => ...)` being called and configured as outlined in the previous scenario.

Expand Down
Binary file removed docs/images/Auth0All.png
Binary file not shown.
Binary file removed docs/images/Auth0Authentication+Management.png
Binary file not shown.
Binary file removed docs/images/Auth0Authentication.png
Binary file not shown.
5 changes: 3 additions & 2 deletions samples/Sample.AspNetCore/Sample.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.36.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.4" />
<PackageReference Include="Grpc.AspNetCore" Version="2.38.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.8" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions samples/Sample.ConsoleApp/Sample.ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.15.7" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.36.0" />
<PackageReference Include="Grpc.Tools" Version="2.36.4">
<PackageReference Include="Google.Protobuf" Version="3.17.3" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.38.0" />
<PackageReference Include="Grpc.Tools" Version="2.38.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
7 changes: 4 additions & 3 deletions src/Auth0Net.DependencyInjection/Auth0Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public static IHttpClientBuilder AddAuth0AuthenticationClientCore(this IServiceC
if (services.Any(x => x.ServiceType == typeof(IAuthenticationApiClient)))
throw new InvalidOperationException("AuthenticationApiClient has already been registered!");

services.AddOptions<Auth0Configuration>().Validate(x => !string.IsNullOrWhiteSpace(x.Domain), "Auth0 Domain cannot be null or empty");
services.Configure<Auth0Configuration>(x=> x.Domain = domain);
services.AddOptions<Auth0Configuration>()
.Configure(x => x.Domain = domain)
.Validate(x => !string.IsNullOrWhiteSpace(x.Domain), "Auth0 Domain cannot be null or empty");

services.AddScoped<IAuthenticationApiClient, InjectableAuthenticationApiClient>();
return services.AddHttpClient<IAuthenticationConnection, HttpClientAuthenticationConnection>();
Expand All @@ -53,10 +54,10 @@ public static IHttpClientBuilder AddAuth0AuthenticationClient(this IServiceColle
throw new InvalidOperationException("AuthenticationApiClient has already been registered!");

services.AddOptions<Auth0Configuration>()
.Configure(config)
.Validate(x => !string.IsNullOrWhiteSpace(x.ClientId) && !string.IsNullOrWhiteSpace(x.Domain) && !string.IsNullOrWhiteSpace(x.ClientSecret),
"Auth0 Configuration cannot have empty values");

services.Configure(config);
services.AddLazyCache();

services.AddScoped<IAuth0TokenCache, Auth0TokenCache>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<Version>1.4.0</Version>
<Version>1.4.1</Version>
<Authors>Hawxy</Authors>
<Description>Dependency Injection, HttpClientFactory &amp; ASP.NET Core extensions for Auth0.NET</Description>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
Expand All @@ -18,8 +18,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Auth0.AuthenticationApi" Version="7.8.0" />
<PackageReference Include="Auth0.ManagementApi" Version="7.8.0" />
<PackageReference Include="Auth0.AuthenticationApi" Version="7.8.1" />
<PackageReference Include="Auth0.ManagementApi" Version="7.8.1" />
<PackageReference Include="LazyCache.AspNetCore" Version="2.1.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
Expand All @@ -43,7 +43,7 @@
</ItemGroup>

<ItemGroup>
<None Include="Images\icon.png" Pack="True" PackagePath="" />
<None Include="Images\icon.png" Pack="true" PackagePath=""/>
</ItemGroup>

</Project>
Binary file modified src/Auth0Net.DependencyInjection/Images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FakeItEasy" Version="7.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="FakeItEasy" Version="7.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit b272972

Please sign in to comment.