diff --git a/Package.Build.props b/Package.Build.props index cd5a58f..f56fc55 100644 --- a/Package.Build.props +++ b/Package.Build.props @@ -1,13 +1,13 @@ - 1.0.0-beta.1 + 1.0.0 Hawxy true Apache-2.0 https://github.com/Hawxy/Fga.Net https://github.com/Hawxy/Fga.Net git - Hawxy 2022-2023 + Hawxy 2022-2024 true README.md diff --git a/README.md b/README.md index 8b597b0..f522c01 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Fga.Net.DependencyInjection?label=Fga.Net.DependencyInjection&style=flat-square)](https://www.nuget.org/packages/Fga.Net.DependencyInjection) [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Fga.Net.AspNetCore?label=Fga.Net.AspNetCore&style=flat-square)](https://www.nuget.org/packages/Fga.Net.AspNetCore) -#### Note: This project is currently in beta. Breaking changes may occur before release. - ### Packages **`Fga.Net.DependencyInjection`**: Provides dependency injection/configuration extensions for [OpenFga.Sdk](https://github.com/openfga/dotnet-sdk) diff --git a/build/_build.csproj b/build/_build.csproj index 54b9d91..1b97ce9 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,7 +11,7 @@ - + diff --git a/samples/Fga.Example.AspNetCore/Fga.Example.AspNetCore.csproj b/samples/Fga.Example.AspNetCore/Fga.Example.AspNetCore.csproj index 169fc9b..0919f17 100644 --- a/samples/Fga.Example.AspNetCore/Fga.Example.AspNetCore.csproj +++ b/samples/Fga.Example.AspNetCore/Fga.Example.AspNetCore.csproj @@ -1,14 +1,14 @@  - net7.0 + net8.0 enable enable e566b5e2-c31c-477a-968d-5f9b0e90ec02 - + diff --git a/samples/Fga.Example.AspNetCore/Program.cs b/samples/Fga.Example.AspNetCore/Program.cs index da88f78..b0947ae 100644 --- a/samples/Fga.Example.AspNetCore/Program.cs +++ b/samples/Fga.Example.AspNetCore/Program.cs @@ -26,6 +26,7 @@ }; }); +builder.Services.AddHttpLogging(x => { }); // Auth0 FGA builder.Services.AddOpenFgaClient(config => diff --git a/samples/Fga.Example.GenericHost/Fga.Example.GenericHost.csproj b/samples/Fga.Example.GenericHost/Fga.Example.GenericHost.csproj index bbe448e..e45139c 100644 --- a/samples/Fga.Example.GenericHost/Fga.Example.GenericHost.csproj +++ b/samples/Fga.Example.GenericHost/Fga.Example.GenericHost.csproj @@ -1,14 +1,14 @@ - net6.0 + net8.0 enable enable dotnet-Fga.Example.GenericHost-9C6D4616-909E-4604-983E-E53E717DECFB - + diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaAttribute.cs index af4e879..054b3a7 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaAttribute.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaBaseObjectAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaBaseObjectAttribute.cs index 5eb24c2..83ae60c 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaBaseObjectAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaBaseObjectAttribute.cs @@ -1,4 +1,22 @@ -using Microsoft.AspNetCore.Http; +#region License +/* + Copyright 2021-2024 Hawxy + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion + +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaHeaderObjectAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaHeaderObjectAttribute.cs index fdc33b3..17e2935 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaHeaderObjectAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaHeaderObjectAttribute.cs @@ -1,4 +1,22 @@ -using Fga.Net.AspNetCore.Exceptions; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion + +using Fga.Net.AspNetCore.Exceptions; using Microsoft.AspNetCore.Http; namespace Fga.Net.AspNetCore.Authorization.Attributes; diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaPropertyObjectAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaPropertyObjectAttribute.cs index e101a55..0ccde1a 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaPropertyObjectAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaPropertyObjectAttribute.cs @@ -1,4 +1,21 @@ -using System.Text.Json; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion +using System.Text.Json; using Fga.Net.AspNetCore.Exceptions; using Microsoft.AspNetCore.Http; diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaQueryObjectAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaQueryObjectAttribute.cs index bc91f88..a4ac952 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaQueryObjectAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaQueryObjectAttribute.cs @@ -1,4 +1,21 @@ -using Fga.Net.AspNetCore.Exceptions; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion +using Fga.Net.AspNetCore.Exceptions; using Microsoft.AspNetCore.Http; namespace Fga.Net.AspNetCore.Authorization.Attributes; diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaRouteObjectAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaRouteObjectAttribute.cs index feaea23..cea60bf 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaRouteObjectAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaRouteObjectAttribute.cs @@ -1,4 +1,21 @@ -using Fga.Net.AspNetCore.Exceptions; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion +using Fga.Net.AspNetCore.Exceptions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; diff --git a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaStringAttribute.cs b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaStringAttribute.cs index 698e9c7..62409d9 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaStringAttribute.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Attributes/FgaStringAttribute.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/FgaAuthorizationDefaults.cs b/src/Fga.Net.AspNetCore/Authorization/FgaAuthorizationDefaults.cs index 5f8ed18..ad20f9c 100644 --- a/src/Fga.Net.AspNetCore/Authorization/FgaAuthorizationDefaults.cs +++ b/src/Fga.Net.AspNetCore/Authorization/FgaAuthorizationDefaults.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/FgaCheckDecorator.cs b/src/Fga.Net.AspNetCore/Authorization/FgaCheckDecorator.cs index 8e31fa5..3d3284d 100644 --- a/src/Fga.Net.AspNetCore/Authorization/FgaCheckDecorator.cs +++ b/src/Fga.Net.AspNetCore/Authorization/FgaCheckDecorator.cs @@ -1,7 +1,23 @@ -using OpenFga.Sdk.Api; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion + using OpenFga.Sdk.Client; using OpenFga.Sdk.Client.Model; -using OpenFga.Sdk.Model; namespace Fga.Net.AspNetCore.Authorization; diff --git a/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationHandler.cs b/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationHandler.cs index ed459eb..f1432ea 100644 --- a/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationHandler.cs +++ b/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationHandler.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationRequirement.cs b/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationRequirement.cs index caa6a12..1b4010d 100644 --- a/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationRequirement.cs +++ b/src/Fga.Net.AspNetCore/Authorization/FineGrainedAuthorizationRequirement.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/Log.cs b/src/Fga.Net.AspNetCore/Authorization/Log.cs index 52f4780..9a7f24a 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Log.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Log.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/Authorization/MinimalApiExtensions.cs b/src/Fga.Net.AspNetCore/Authorization/MinimalApiExtensions.cs index d0aa936..4258e49 100644 --- a/src/Fga.Net.AspNetCore/Authorization/MinimalApiExtensions.cs +++ b/src/Fga.Net.AspNetCore/Authorization/MinimalApiExtensions.cs @@ -1,3 +1,20 @@ +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion using Fga.Net.AspNetCore.Authorization.Attributes; using Microsoft.AspNetCore.Builder; diff --git a/src/Fga.Net.AspNetCore/Authorization/Validation.cs b/src/Fga.Net.AspNetCore/Authorization/Validation.cs index 58cd870..5c2b0e1 100644 --- a/src/Fga.Net.AspNetCore/Authorization/Validation.cs +++ b/src/Fga.Net.AspNetCore/Authorization/Validation.cs @@ -1,3 +1,20 @@ +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion namespace Fga.Net.AspNetCore.Authorization; internal static class Validation diff --git a/src/Fga.Net.AspNetCore/Controllers/FgaControllerBase.cs b/src/Fga.Net.AspNetCore/Controllers/FgaControllerBase.cs deleted file mode 100644 index d8ea7c4..0000000 --- a/src/Fga.Net.AspNetCore/Controllers/FgaControllerBase.cs +++ /dev/null @@ -1,61 +0,0 @@ -#region License -/* - Copyright 2021-2023 Hawxy - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -#endregion - -using Microsoft.AspNetCore.Mvc; -using OpenFga.Sdk.Api; -using OpenFga.Sdk.Model; - -namespace Fga.Net.AspNetCore.Controllers; - -/// -/// A base ASP.NET Core controller that adds an extension method for FGA checks. -/// -public class FgaControllerBase : ControllerBase -{ - private readonly OpenFgaApi _client; - /// - /// - /// - /// - public FgaControllerBase(OpenFgaApi client) - { - _client = client; - } - - /// - /// - /// - /// - /// - /// - /// - /// - public async Task Check(string user, string relation, string @object, CancellationToken ct) - { - var checkRes = await _client.Check(new CheckRequest() - { - TupleKey = new TupleKey - { - User = user, - Relation = relation, - Object = @object - } - }, ct); - return checkRes.Allowed.HasValue && checkRes.Allowed.Value; - } -} \ No newline at end of file diff --git a/src/Fga.Net.AspNetCore/Exceptions/FgaMiddlewareException.cs b/src/Fga.Net.AspNetCore/Exceptions/FgaMiddlewareException.cs index 49dce5a..d7b6314 100644 --- a/src/Fga.Net.AspNetCore/Exceptions/FgaMiddlewareException.cs +++ b/src/Fga.Net.AspNetCore/Exceptions/FgaMiddlewareException.cs @@ -1,4 +1,21 @@ -namespace Fga.Net.AspNetCore.Exceptions; +#region License +/* + Copyright 2021-2024 Hawxy (JT) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +#endregion +namespace Fga.Net.AspNetCore.Exceptions; /// /// Custom exception for FGA middleware internals. diff --git a/src/Fga.Net.AspNetCore/FgaAspNetCoreConfiguration.cs b/src/Fga.Net.AspNetCore/FgaAspNetCoreConfiguration.cs index e4fced9..161c9cc 100644 --- a/src/Fga.Net.AspNetCore/FgaAspNetCoreConfiguration.cs +++ b/src/Fga.Net.AspNetCore/FgaAspNetCoreConfiguration.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net.AspNetCore/ServiceCollectionExtensions.cs b/src/Fga.Net.AspNetCore/ServiceCollectionExtensions.cs index 121d3fa..c2e309d 100644 --- a/src/Fga.Net.AspNetCore/ServiceCollectionExtensions.cs +++ b/src/Fga.Net.AspNetCore/ServiceCollectionExtensions.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/Configuration/Auth0FgaConnectionBuilder.cs b/src/Fga.Net/Configuration/Auth0FgaConnectionBuilder.cs index 541d098..03f46de 100644 --- a/src/Fga.Net/Configuration/Auth0FgaConnectionBuilder.cs +++ b/src/Fga.Net/Configuration/Auth0FgaConnectionBuilder.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/Configuration/FgaClientConfiguration.cs b/src/Fga.Net/Configuration/FgaClientConfiguration.cs index 67121d7..111cd2f 100644 --- a/src/Fga.Net/Configuration/FgaClientConfiguration.cs +++ b/src/Fga.Net/Configuration/FgaClientConfiguration.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/Configuration/OpenFgaConnectionBuilder.cs b/src/Fga.Net/Configuration/OpenFgaConnectionBuilder.cs index 261ae3a..8cb2989 100644 --- a/src/Fga.Net/Configuration/OpenFgaConnectionBuilder.cs +++ b/src/Fga.Net/Configuration/OpenFgaConnectionBuilder.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/Fga.Net.DependencyInjection.csproj b/src/Fga.Net/Fga.Net.DependencyInjection.csproj index 4bedef8..428f057 100644 --- a/src/Fga.Net/Fga.Net.DependencyInjection.csproj +++ b/src/Fga.Net/Fga.Net.DependencyInjection.csproj @@ -1,6 +1,6 @@ - net6.0;net7.0 + net6.0;net8.0 enable enable @@ -14,7 +14,7 @@ - + diff --git a/src/Fga.Net/FgaConfigurationBuilder.cs b/src/Fga.Net/FgaConfigurationBuilder.cs index 4df7346..f7f6815 100644 --- a/src/Fga.Net/FgaConfigurationBuilder.cs +++ b/src/Fga.Net/FgaConfigurationBuilder.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/FgaConnectionConfiguration.cs b/src/Fga.Net/FgaConnectionConfiguration.cs index 19213ca..59e1dad 100644 --- a/src/Fga.Net/FgaConnectionConfiguration.cs +++ b/src/Fga.Net/FgaConnectionConfiguration.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/InjectableFgaApi.cs b/src/Fga.Net/InjectableFgaApi.cs index a6f211b..61fc315 100644 --- a/src/Fga.Net/InjectableFgaApi.cs +++ b/src/Fga.Net/InjectableFgaApi.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/Fga.Net/ServiceCollectionExtensions.cs b/src/Fga.Net/ServiceCollectionExtensions.cs index 13187e0..c324466 100644 --- a/src/Fga.Net/ServiceCollectionExtensions.cs +++ b/src/Fga.Net/ServiceCollectionExtensions.cs @@ -1,6 +1,6 @@ #region License /* - Copyright 2021-2023 Hawxy + Copyright 2021-2024 Hawxy (JT) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/tests/Fga.Net.Tests/Fga.Net.Tests.csproj b/tests/Fga.Net.Tests/Fga.Net.Tests.csproj index e999af2..abb3156 100644 --- a/tests/Fga.Net.Tests/Fga.Net.Tests.csproj +++ b/tests/Fga.Net.Tests/Fga.Net.Tests.csproj @@ -1,23 +1,22 @@  - net7.0 + net8.0 enable false - + - - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Fga.Net.Tests/Unit/AttributeTests.cs b/tests/Fga.Net.Tests/Unit/AttributeTests.cs index bba04ae..a346b51 100644 --- a/tests/Fga.Net.Tests/Unit/AttributeTests.cs +++ b/tests/Fga.Net.Tests/Unit/AttributeTests.cs @@ -6,6 +6,7 @@ using Fga.Net.AspNetCore.Exceptions; using HttpContextMoq; using HttpContextMoq.Extensions; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Primitives; @@ -44,7 +45,7 @@ public async Task HeaderObjectAttribute_ThrowsOnMissingHeader() [Fact] public async Task PropertyObjectAttribute_WorksAsExpected() { - var data = Encoding.UTF8.GetBytes("{\"Foo\":\"Bar\",\"Array\":[]}"); + var data = "{\"Foo\":\"Bar\",\"Array\":[]}"u8.ToArray(); var httpContext = new HttpContextMock() .SetupUrl("http://localhost:8000/path") @@ -64,7 +65,7 @@ public async Task PropertyObjectAttribute_WorksAsExpected() public async Task PropertyObjectAttribute_ThrowsOnMissingProperty() { var data = "{\"Foo\":\"Bar\",\"Array\":[]}"u8.ToArray(); - + var httpContext = new HttpContextMock() .SetupUrl("http://localhost:8000/path") .SetupRequestMethod("POST")