Applyze.Shared.Authentication.AspNetCore 1.0.6.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Applyze.Shared.Authentication.AspNetCore --version 1.0.6.2
NuGet\Install-Package Applyze.Shared.Authentication.AspNetCore -Version 1.0.6.2
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="Applyze.Shared.Authentication.AspNetCore" Version="1.0.6.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Applyze.Shared.Authentication.AspNetCore --version 1.0.6.2
#r "nuget: Applyze.Shared.Authentication.AspNetCore, 1.0.6.2"
#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.
// Install Applyze.Shared.Authentication.AspNetCore as a Cake Addin
#addin nuget:?package=Applyze.Shared.Authentication.AspNetCore&version=1.0.6.2

// Install Applyze.Shared.Authentication.AspNetCore as a Cake Tool
#tool nuget:?package=Applyze.Shared.Authentication.AspNetCore&version=1.0.6.2

Applyze.Shared.Authentication

This package includes AspNetCore 2.2 Authentication Attributes for Applyze Tenant.


Installation

NuGet Package

You can find NuGet Package and instructions from here

  • Open Package Manager Console and run following command:
Install-Package Applyze.Shared.Authentication.AspNetCore
  • Or just add following package reference to .csproj file:
    <PackageReference Include="Applyze.Shared.Authentication" Version="1.0.4" />
    <PackageReference Include="Applyze.Shared.Authentication.AspNetCore" Version="1.0.4" />

Set-Up

  • Go to Startup.cs
  • Add following code into ConfigureServices() method:
services.AddApplyzeAuthentication(builder => builder.SetTenantBaseUrl("test.com/v1"));
// or you can set it from your configuretion
services.AddApplyzeAuthentication(builder => builder.SetTenantBaseUrl(Configuration.GetSection("Applyze:TenantUrl").Value));

Usage

Authenticate with Attribute

There is an ApplyzeAuthenticateAttribute which is located at Applyze.Shared.Authentication.Filters namespace nad ready to use authenticate your Controllers or Actions.

Sample:

  • Add following code into ConfigureServices() method:
//...
using Applyze.Shared.Authentication.Filters;
//...

[ApplyzeAuthenticate] // <-- Authenticates ApiKey from Tenant
public class YourController()
{
    [AllowAnonymous]  // <-- Authentication disabled for this action
    public IActionResult YourAction()
    {
        //...
    }

    [ApplyzeAuthenticate(AuthenticationType.ApplicationLevel)] // <-- Authenticates ApiKey, AppKey
    public IActionResult YourOtherAction()
    {
        //...
    }

    [ApplyzeAuthenticate(AuthenticationType.ApplicationOwnerLevel)] // <-- Authenticates ApiKey, UserApiKey and AppKey from Tenant
    public IActionResult YourAnotherAction()
    {
        //...
    }
}

Or you can combine your own requirements with bitwise OR like following sample:

    [ApplyzeAuthenticate(AuthenticationType.ApiKey | AuthenticationType.UserApiKey | AuthenticationType.AppKey)]

Getting Authenticated App
//...
using Applyze.Shared.Authentication.Helpers;
//...

[ApplyzeAuthenticate(AuthenticationType.ApplicationLevel)] 
public class YourController()
{
    public IActionResult YourAction()
    {
        var app = HttpContext.GetCachedApp();
        Console.WriteLine(app.Name);
        //...
    }
}

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. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Applyze.Shared.Authentication.AspNetCore:

Package Downloads
Applyze.Shared.Authorization.AspNetCore

AspNetCore Implementation of Applyze Authorization

Applyze.Web.AspNetCore.Resolver

This Library connection string resolver for AspNetCore.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.11.0 770 11/13/2020
2.10.1 455 10/16/2020
2.10.0 402 10/14/2020
2.9.0-pre.1 256 7/17/2020
2.8.1-pre.4 236 7/17/2020
2.8.1-pre.3 241 7/17/2020
2.8.1-pre.2 244 7/17/2020
2.8.1-pre.1 252 7/17/2020
2.8.0 1,738 5/13/2020
2.7.0 558 5/8/2020
2.6.1 501 5/8/2020
2.6.0 509 5/8/2020
2.5.0 466 5/8/2020
2.4.0 890 4/20/2020
2.3.3 456 4/7/2020
2.3.2 484 4/7/2020
2.3.1 462 4/7/2020
2.3.0 481 4/7/2020
2.2.2 1,107 2/14/2020
2.2.1 1,115 1/29/2020
2.2.0 619 1/29/2020
2.1.1 653 12/3/2019
2.1.0 531 11/18/2019
2.0.0 538 11/12/2019
1.0.7-pre1 426 10/24/2019
1.0.6.2 620 7/24/2019
1.0.6.1 675 7/24/2019

Released