Auth0ExtensionManager 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Auth0ExtensionManager --version 1.1.0
                    
NuGet\Install-Package Auth0ExtensionManager -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Auth0ExtensionManager" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Auth0ExtensionManager" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Auth0ExtensionManager" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Auth0ExtensionManager --version 1.1.0
                    
#r "nuget: Auth0ExtensionManager, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Auth0ExtensionManager@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Auth0ExtensionManager&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Auth0ExtensionManager&version=1.1.0
                    
Install as a Cake Tool

Introduction

Project created to quickly onboard Auth0 .net 3.1 + apps

Add to appSettgins

Add the following section to appSettings.json file

 "Auth0": {
    "Authority": "[DOMAIN]",
    "ApiIdentifier": "[AUDIENCE]"
  },

Update statup.cs file

Next in Statup.cs add the following code to the ConfigureServices method/section

services.AddAuth0ExtensionManager();

Next made sure you have add the following to the Configure method in statup.cs

app.UseAuthentication(); app.UseAuthorization();

Secure Controllers

you can use the follwoing sample code to test if your security is configured correctly.

   [Route("api")]
    [ApiController]
    public class ApiController : ControllerBase
    {
        
            [HttpGet("public")]
        public IActionResult Public()
        {
            return Ok(new
            {
                Message = "Hello from a public endpoint! You don't need to be authenticated to see this."
            });
        }

        [HttpGet("private")]
        [Authorize]
        public IActionResult Private()
        {
            return Ok(new
            {
                Message = "Hello from a private endpoint! You need to be authenticated to see this."
            });
        }

        [HttpGet("private-scoped")]
        [Authorize("read:messages")]
        public IActionResult Scoped()
        {
            return Ok(new
            {
                Message = "Hello from a private endpoint! You need to be authenticated and have a scope of read:messages to see this."
            });
        }

        // This is a helper action. It allows you to easily view all the claims of the token.
        [HttpGet("claims")]
        public IActionResult Claims()
        {
            return Ok(User.Claims.Select(c =>
                new
                {
                    c.Type,
                    c.Value
                }));
        }
      
    }

that's it all done. just [Authorize] or the [Authorize("read:messages")] the a spicifc scope to any controller or method in the controller you would like to secure.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 972 6/30/2021
1.1.0 496 12/25/2020