Skip to content

Releases: Hawxy/Fga.Net

v1.2

09 Apr 12:13
d25507f
Compare
Choose a tag to compare
  • Add support for AU/EU Auth0 FGA regions via SetEnvironment
  • Update to OpenFGA 0.3.1

v1.1

05 Jan 11:11
41e0934
Compare
Choose a tag to compare

Breaking Changes

  • Update to OpenFga.Sdk 0.3.0. This release contains a number of breaking changes to contract types and I'd recommend reading the upstream release notes.

Misc

  • Marked SetConnection with schema overload as obsolete inline with upstream.
  • Adjusted authorization handler to throw an exception if the incorrect routing context (ie non-endpoint routing) is passed in rather than silently failing. Please open an issue if this has any unintended side-effects. (Closes #13)

v1.0

18 Dec 12:21
f2574f6
Compare
Choose a tag to compare
  • Add .NET 8 TFM
  • Update dependencies

This release is functionally identical to the previous beta release.

v1.0 Beta 1 🚀

29 May 02:29
c59b3a9
Compare
Choose a tag to compare

This releases contains considerable breaking changes to the configuration. I consider this API final for the v1.0 release pending any usability issues.

Breaking changes

  • DSL v1.1 is now a hard requirement.
  • Added a new configuration builder that encapsulates all out of the box authentication scenarios to improve DX
builder.Services.AddOpenFgaClient(config =>
{
-     config.WithAuth0FgaDefaults(builder.Configuration["Auth0Fga:ClientId"], builder.Configuration["Auth0Fga:ClientSecret"]);
-     config.StoreId = builder.Configuration["Auth0Fga:StoreId"];  
});

builder.Services.AddOpenFgaMiddleware(middlewareConfig =>
{
-     middlewareConfig.UserIdentityResolver = principal => $"user:{principal.Identity!.Name!}";
});

builder.Services.AddOpenFgaClient(config =>
{
+     config.ConfigureAuth0Fga(x =>
+     {
+         x.WithAuthentication(builder.Configuration["Auth0Fga:ClientId"]!, builder.Configuration["Auth0Fga:ClientSecret"]!);
+     });
+     config.SetStoreId(builder.Configuration["Auth0Fga:StoreId"]!);
});

builder.Services.AddOpenFgaMiddleware(middlewareConfig =>
{
+     middlewareConfig.SetUserIdentifier("user", principal => principal.Identity!.Name!);
});

See the updated README for more information, including updated OpenFga configuration.

Features

  • Added PostConfigureFgaClient to overwrite FGA configuration for testing scenarios.

Bug fixes

  • Fixed an issue that resulted in the FGA clients refreshing access tokens on every request. FGA clients are now registered as singletons.
  • Added validation & logging to the middleware to prevent invalid user identifiers reaching the FGA API and throwing an unhelpful exception.

v0.9 Alpha

14 Apr 05:11
6e70483
Compare
Choose a tag to compare

New Features

  • Added support for OpenFgaClient, this type offers ergonomic improvements over OpenFgaApi and should be preferred. See the official post for more information.
  • The middleware will now perform a parallel check if multiple check attributes are present for a given endpoint.
  • Added Minimal API extensions for the built-in attributes:
builder.MapGet("/", () => /****/)
// FgaHeaderObjectAttribute
.WithFgaHeaderCheck("x", "y", "z")
// FgaRouteObjectAttribute
.WithFgaRouteCheck("x", "y", "z")
// FgaQueryObjectAttribute
.WithFgaQueryCheck("x", "y", "z")
// FgaPropertyObjectAttribute
.WithFgaPropertyCheck("x", "y", "z");
  • Improved logging if an exception occurs during a middleware check.

Breaking Changes

  • Remove previously obsoleted AddOpenFga extension.

v0.8 Alpha

03 Jan 04:03
4d03308
Compare
Choose a tag to compare

Breaking Changes

  • Updated OpenFga.Sdk to 0.2.0
  • Obsoleted AddOpenFga, use AddOpenFgaClient & AddOpenFgaMiddleware instead:
- builder.Services.AddOpenFga(clientConfig =>
{
    clientConfig.WithAuth0FgaDefaults(builder.Configuration["Auth0Fga:ClientId"], builder.Configuration["Auth0Fga:ClientSecret"]);
    clientConfig.StoreId = builder.Configuration["Auth0Fga:StoreId"];  
- }, middlewareConfig =>
{
    middlewareConfig.UserIdentityResolver = principal => principal.Identity!.Name!;
});

+ builder.Services.AddOpenFgaClient(clientConfig =>
{
    clientConfig.WithAuth0FgaDefaults(builder.Configuration["Auth0Fga:ClientId"], builder.Configuration["Auth0Fga:ClientSecret"]);
    clientConfig.StoreId = builder.Configuration["Auth0Fga:StoreId"];  
});

+ builder.Services.AddOpenFgaMiddleware(middlewareConfig =>
{
    middlewareConfig.UserIdentityResolver = principal => principal.Identity!.Name!;
});

New Features

  • FgaPropertyObjectAttribute now parses JSON asynchronously.
  • Dual-targeted .NET 6 & .NET 7

Note about DSL v1.1

In order to use the built-in attributes with DSL v1.1, you must pass in a user type via the resolver:

    config.UserIdentityResolver = principal => $"user:{principal.Identity!.Name!}";

This is a bit clunky, so expect this syntax to change in a future release. If you encounter any other rough edges with v1.1, please open an issue.

v0.7 Alpha

01 Oct 12:49
7a72f49
Compare
Choose a tag to compare

Breaking Changes

  • TupleCheckAttribute -> FgaAttribute
  • StringTupleCheckAttribute -> FgaStringAttribute
  • Updated OpenFga.Sdk to 0.1.0

New Features

  • Added a number of new attributes to cover common FGA authorization scenarios, see the README for more info.
  • Added additional logging & error handling to FGA middleware.

v0.6 Alpha

01 Sep 13:50
4880b62
Compare
Choose a tag to compare

Breaking Changes

  • This project now hangs off OpenFga.Sdk instead the Auth0 FGA client, and thus is now compatible with both OpenFGA & Auth0 FGA
  • The DI Extensions have been renamed to reflect this change:
// old
builder.Services.AddAuth0Fga(x =>
{
    x.ClientId = builder.Configuration["Auth0Fga:ClientId"];
    x.ClientSecret = builder.Configuration["Auth0Fga:ClientSecret"];
    x.StoreId = builder.Configuration["Auth0Fga:StoreId"];
});

// new
builder.Services.AddOpenFga(x =>
{
    x.WithAuth0FgaDefaults(builder.Configuration["Auth0Fga:ClientId"], builder.Configuration["Auth0Fga:ClientSecret"]);

    x.StoreId = builder.Configuration["Auth0Fga:StoreId"];
});
  • The WithAuth0FgaDefaults extension has been added to allow easy setup of the OpenFGA client for Auth0 FGA.

See the README for OpenSDK usage.

v0.5 Alpha

18 Jun 07:10
3a85f03
Compare
Choose a tag to compare
  • Update to Auth0.Fga v0.3.1 and deal with breaking changes
  • Add debug logging to middleware
  • Enable Middleware tests once again

v0.4 Alpha

17 Apr 13:36
7d4b3b0
Compare
Choose a tag to compare

Breaking Changes

  • Refactors package to sit on top of Auth0.Fga as the internal client.
  • Fga.Net has been renamed to Fga.Net.DependencyInjection. The core package may be used again at a later time.
  • Reverts support for multi-store scenarios added in v0.3 as it was discussed that consumers are unlikely to require this.
  • DI Extensions have been simplified to a single call per package:
// Fga.Net.DependencyInjection
services.AddAuth0FgaClient(x=> /**/);

// Fga.Net.AspNetCore
services.AddAuth0Fga(x=> /**/);