Authlink.Policy.Client.Http 1.0.3

dotnet add package Authlink.Policy.Client.Http --version 1.0.3
                    
NuGet\Install-Package Authlink.Policy.Client.Http -Version 1.0.3
                    
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="Authlink.Policy.Client.Http" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Authlink.Policy.Client.Http" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Authlink.Policy.Client.Http" />
                    
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 Authlink.Policy.Client.Http --version 1.0.3
                    
#r "nuget: Authlink.Policy.Client.Http, 1.0.3"
                    
#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 Authlink.Policy.Client.Http@1.0.3
                    
#: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=Authlink.Policy.Client.Http&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Authlink.Policy.Client.Http&version=1.0.3
                    
Install as a Cake Tool

📦 Package Overview

Authlink.Policy.Client.Http provides a concrete HTTP implementation of the IPolicyClient abstraction from Authlink.Policy.Client.Core, enabling seamless integration with Authlink’s Policy Decision Point (PDP) over REST. It leverages System.Net.Http and HttpClientFactory to deliver a resilient, configurable client for decision requests.

It is intended to be consumed alongside:

  • Authlink.Policy.Client.Core

Optionally paired with:

  • Authlink.Policy.Client.AspNetCore

🚀 Install

dotnet add package Authlink.Policy.Client.Http

Or via Package Manager:

PM> Install-Package Authlink.Policy.Client.Http

🔧 Purpose

This package delivers:

  • A PolicyHttpClient that implements IPolicyClient over HTTP
  • Transparent JSON (de)serialization of DecisionRequest / DecisionResponse
  • Configurable endpoint, timeout, and default client‐ID via PolicyHttpClientOptions
  • Fail‐closed behavior on HTTP errors (non-200 ⇒ Deny)
  • Easy registration with IServiceCollection

⚙️ Usage

1. Register in Startup or Program

builder.Services.AddPolicyHttpClient(options =>
{
    options.BaseUrl = "https://authlink.co.za";
    options.ClientId = new Guid("11111111-2222-3333-4444-555555555555");
});

2. Inject and call

public class InvoiceService
{
    private readonly IPolicyClient _policy;

    public InvoiceService(IPolicyClient policyClient)
    {
        _policy = policyClient;
    }

    public async Task<bool> CanCreateInvoiceAsync(Guid userId)
    {
        var request = new DecisionRequest 
        {
            UserId = userId,
            PermissionKey = "invoice:create",
            ResourceKey = "INVOICE"
        };
        
        var response = await _policy.DecideAsync(request);

        return response.Decision == Decision.Allow;
    }
}

📚 Documentation

Coming soon at: https://docs.authlink.co.za

📄 License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Authlink.Policy.Client.Http:

Package Downloads
Authlink.Policy.Client.ServiceStack

Adds seamless Authlink PDP enforcement to ServiceStack services via a RequiresPermission attribute and plugin, leveraging the HTTP client for fail-closed policy decisions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 142 8/4/2025
1.0.2 123 8/4/2025
1.0.1 64 8/1/2025
1.0.0 70 8/1/2025