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 867 11/13/2020
2.11.0-pratikislem 98 6/27/2024
2.10.1 481 10/16/2020
2.10.0 433 10/14/2020
2.9.0-pre.1 274 7/17/2020
2.8.1-pre.4 250 7/17/2020
2.8.1-pre.3 254 7/17/2020
2.8.1-pre.2 257 7/17/2020
2.8.1-pre.1 266 7/17/2020
2.8.0 1,827 5/13/2020
2.7.0 584 5/8/2020
2.6.1 528 5/8/2020
2.6.0 537 5/8/2020
2.5.0 496 5/8/2020
2.4.0 949 4/20/2020
2.3.3 485 4/7/2020
2.3.2 510 4/7/2020
2.3.1 488 4/7/2020
2.3.0 508 4/7/2020
2.2.2 1,158 2/14/2020
2.2.1 1,179 1/29/2020
2.2.0 657 1/29/2020
2.1.1 706 12/3/2019
2.1.0 559 11/18/2019
2.0.0 567 11/12/2019
1.0.7-pre1 448 10/24/2019
1.0.6.2 662 7/24/2019
1.0.6.1 702 7/24/2019

Released