Take.Security.AccessControl 1.0.1

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

// Install Take.Security.AccessControl as a Cake Tool
#tool nuget:?package=Take.Security.AccessControl&version=1.0.1                

Informations

This package is responsible for managing tokens, enabling more security in accesses between bot (Take Blip) and API's. Tokens are managed by the package and saved in the bot's Bucket (https://docs.blip.ai/#bucket). The name of the document in the bucket is tokenAccessControl

Usage

After installing the package, you'll need to tell your API to use this scheme in the Startup.cs file. The simplest way is using the extension method provided with the package:

public void ConfigureServices(IServiceCollection services)
{
    // ...
    services.UseBotAuthenticationToken("bot identifier", "bot accesskey");
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    // ...
    app.UseHttpsRedirection()
       .UseAuthentication() // this is the line that should be added, and it MUST be before .UseRouting()
       .UseRouting()
    // ...
}

Once your API is configured to use it, you can enable it on a controller like so:

[Route("api/[controller]")]
[ApiController]
[Authorize] // add this to protect the whole controller
public class HealthController : ControllerBase
{

}

To protect only a given method:

[Route("api/[controller]")]
[ApiController]
public class HealthController : ControllerBase
{
    [HttpGet, Authorize] // add the Authorize attribute here instead, to protect only the action
    public IActionResult HealthCheck() {} 
}

To exclude a given method from a protected controller:

[Route("api/[controller]")]
[ApiController, Authorize] // add the attribute
public class HealthController : ControllerBase
{
    [HttpGet, AllowAnonymous] // Methods with AllowAnonymous will ignore the auth check
    public IActionResult HealthCheck() {}
    
    [HttpGet("authorize")] // Even without the explicit attribute, this will be protected by the one on the controller
    public IActionResult KeyCheck() {}
}

To use the generated token, you must send the Key: Authorization; Value: Bearer {{bucket.tokenAccessControl@key}}, as you can see in the image:

image

Remembering that the key will be created as soon as you run Startup.cs

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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
1.1.0 341 12/9/2022
1.0.2 446 11/20/2022
1.0.1 353 8/25/2022
1.0.0 340 8/25/2022