Skip to content

Commit d6e7858

Browse files
authored
v2.1 (#18)
Co-authored-by: JT <[email protected]>
1 parent 1a0801f commit d6e7858

29 files changed

+81
-60
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
## Getting Started
1212

13-
This package is compatible with the OSS OpenFGA as well as the managed Auth0 FGA service.
13+
This package is compatible with the OSS OpenFGA as well as the managed Okta FGA service.
1414

15-
Please ensure you have a basic understanding of how FGA works before continuing: [OpenFGA Docs](https://openfga.dev/) or [Auth0 FGA Docs](https://docs.fga.dev/)
15+
Please ensure you have a basic understanding of how FGA works before continuing: [OpenFGA Docs](https://openfga.dev/) or [Okta FGA Docs](https://docs.fga.dev/)
1616

1717
## ASP.NET Core Setup
1818

1919
This tutorial assumes you have authentication setup within your project, such as [JWT bearer authentication via Auth0](https://auth0.com/docs/quickstart/backend/aspnet-core-webapi/01-authorization).
2020

2121
Install `Fga.Net.AspNetCore` from Nuget before continuing.
2222

23-
### Auth0 FGA
23+
### Okta FGA
2424

2525
Ensure you have a Store ID, Client ID, and Client Secret ready from [How to get your API keys](https://docs.fga.dev/integration/getting-your-api-keys).
2626

@@ -29,20 +29,20 @@ Ensure you have a Store ID, Client ID, and Client Secret ready from [How to get
2929
```cs
3030
builder.Services.AddOpenFgaClient(config =>
3131
{
32-
config.ConfigureAuth0Fga(x =>
32+
config.ConfigureOktaFga(x =>
3333
{
3434
// Change to EU/AUS depending on where your store is located
3535
x.SetEnvironment(FgaEnvironment.US);
36-
x.WithAuthentication(builder.Configuration["Auth0Fga:ClientId"]!, builder.Configuration["Auth0Fga:ClientSecret"]!);
36+
x.WithAuthentication(builder.Configuration["OktaFga:ClientId"]!, builder.Configuration["OktaFga:ClientSecret"]!);
3737
});
3838

39-
config.SetStoreId(builder.Configuration["Auth0Fga:StoreId"]!);
39+
config.SetStoreId(builder.Configuration["OktaFga:StoreId"]!);
4040
});
4141

4242
builder.Services.AddOpenFgaMiddleware();
4343
```
4444

45-
The `ConfigureAuth0Fga` extension will configure the client to work with the Auth0 US environment. An environment selector will be added as additional regions come online.
45+
The `ConfigureOktaFga` extension will configure the client to work with the Okta US environment. An environment selector will be added as additional regions come online.
4646

4747
### OpenFGA
4848

@@ -176,7 +176,7 @@ An additional pre-made attribute that allows all tuple values to be hardcoded st
176176

177177
### Contextual Tuples
178178

179-
All attributes supports specifying contextual tuples as part of a check. Inherit & override `GetContextualTuple` to provide the relevant logic in your own attribute.
179+
All attributes supports specifying contextual tuples as part of a check. Inherit & override `GetContextualTuples` to provide the relevant logic in your own attribute.
180180

181181
## Client Injection
182182

@@ -206,21 +206,21 @@ services.PostConfigureFgaClient(config =>
206206
To get started:
207207

208208
1. Install `Fga.Net.DependencyInjection`
209-
2. Add your `StoreId`, `ClientId` and `ClientSecret` Auth0 FGA configuration **OR** `ApiUrl` & `StoreId` OpenFGA configuration to your application configuration, ideally via the [dotnet secrets manager](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows#enable-secret-storage).
209+
2. Add your `StoreId`, `ClientId` and `ClientSecret` Okta FGA configuration **OR** `ApiUrl` & `StoreId` OpenFGA configuration to your application configuration, ideally via the [dotnet secrets manager](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows#enable-secret-storage).
210210
3. Register the authorization client:
211211

212212
```cs
213213
var host = Host.CreateDefaultBuilder(args)
214214
.ConfigureServices((context, services) =>
215215
{
216-
// Auth0 FGA
216+
// Okta FGA
217217
services.AddOpenFgaClient(config =>
218218
{
219-
config.ConfigureAuth0Fga(x =>
219+
config.ConfigureOktaFga(x =>
220220
{
221-
x.WithAuthentication(context.Configuration["Auth0Fga:ClientId"], context.Configuration["Auth0Fga:ClientSecret"]);
221+
x.WithAuthentication(context.Configuration["OktaFga:ClientId"], context.Configuration["OktaFga:ClientSecret"]);
222222
});
223-
config.SetStoreId(context.Configuration["Auth0Fga:StoreId"]);
223+
config.SetStoreId(context.Configuration["OktaFga:StoreId"]);
224224
});
225225

226226
// OpenFGA
@@ -273,4 +273,4 @@ See the [OpenFGA.Sdk docs](https://openfga.dev/docs/getting-started/setup-sdk-cl
273273

274274
## Disclaimer
275275

276-
I am not affiliated with nor represent Auth0 or OpenFGA. All support queries regarding the underlying service should go to the [Auth0 Labs Discord](https://discord.gg/8naAwJfWN6).
276+
I am not affiliated with nor represent Okta or OpenFGA. All support queries regarding the underlying service should go to the respective support channels.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaAttribute.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -52,7 +52,15 @@ public abstract class FgaAttribute : Attribute
5252
/// </summary>
5353
/// <param name="context">The context of the current request</param>
5454
/// <returns>The list of contextual tuples, or null if none were provided</returns>
55+
[Obsolete("Replace with GetContextualTuples")]
5556
public virtual ValueTask<List<ClientTupleKey>?> GetContextualTuple(HttpContext context) => new((List<ClientTupleKey>?)null);
57+
58+
/// <summary>
59+
/// Contextual tuple(s) to apply the check generated from this attribute.
60+
/// </summary>
61+
/// <param name="context">The context of the current request</param>
62+
/// <returns>The list of contextual tuples, or null if none were provided</returns>
63+
public virtual ValueTask<List<ClientTupleKey>?> GetContextualTuples(HttpContext context) => new((List<ClientTupleKey>?)null);
5664

5765
/// <summary>
5866
/// Concats the type and identifier into the object format

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaBaseObjectAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy
3+
Copyright 2021-2025 Hawxy
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaHeaderObjectAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaPropertyObjectAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaQueryObjectAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaRouteObjectAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/Attributes/FgaStringAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/FgaAuthorizationDefaults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

src/Fga.Net.AspNetCore/Authorization/FgaCheckDecorator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#region License
22
/*
3-
Copyright 2021-2024 Hawxy (JT)
3+
Copyright 2021-2025 Hawxy (JT)
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)