Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: niscode auth filtering #14

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Basisregisters.IntegrationDb.sln
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Basisregisters.IntegrationD
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Basisregisters.IntegrationDb.Consumer.BuildingUnit", "src\Basisregisters.IntegrationDb.Consumer.BuildingUnit\Basisregisters.IntegrationDb.Consumer.BuildingUnit.csproj", "{D3170071-1C14-4B17-99A2-96F718097AA1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Basisregisters.IntegrationDb.SuspiciousCases.Api.Tests", "test\Basisregisters.IntegrationDb.SuspiciousCases.Api.Tests\Basisregisters.IntegrationDb.SuspiciousCases.Api.Tests.csproj", "{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -86,13 +88,26 @@ Global
{F3D39574-A172-40C5-A072-D33D19576419}.Release|x86.Build.0 = Release|Any CPU
{012CD10E-1EDE-4014-B7CE-B870E62D1BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{012CD10E-1EDE-4014-B7CE-B870E62D1BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|x64.ActiveCfg = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|x64.Build.0 = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|x86.ActiveCfg = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Debug|x86.Build.0 = Debug|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|Any CPU.Build.0 = Release|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|x64.ActiveCfg = Release|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|x64.Build.0 = Release|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|x86.ActiveCfg = Release|Any CPU
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F3D39574-A172-40C5-A072-D33D19576419} = {C2F8FF63-7A48-4179-A720-86206C42F496}
{012CD10E-1EDE-4014-B7CE-B870E62D1BEC} = {A5E1149A-0437-4CD0-93A2-6E7E059C74BE}
{2046F886-AA42-4EAD-A8FC-F8FC10A743F9} = {A5E1149A-0437-4CD0-93A2-6E7E059C74BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2EB87445-E263-4E1E-89CC-3839170028E5}
Expand Down
3 changes: 2 additions & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,20 @@ nuget Be.Vlaanderen.Basisregisters.Build.Pipeline 6.0.5
nuget Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac 5.1.0
nuget Be.Vlaanderen.Basisregisters.GrAr.Legacy 20.6.0
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer 4.9.1
nuget Be.Vlaanderen.Basisregisters.NisCodeService.HardCoded 1.3.4
nuget Be.Vlaanderen.Basisregisters.Shaperon 9.0.1

// TEST STUFF
nuget Microsoft.NET.Test.Sdk 17.3.1
nuget Microsoft.NET.StringTools 17.8.3
//nuget Microsoft.TestPlatform.TestHost 17.3.1
nuget Microsoft.NETCore.Platforms 6.0.6
nuget Be.Vlaanderen.Basisregisters.DockerUtilities 1.0.1
nuget Microsoft.AspNetCore.Mvc.Testing 6.0.11
nuget Microsoft.AspNetCore.TestHost 6.0.11
nuget FluentAssertions 6.5.1
nuget xunit.runner.visualstudio 2.4.3
nuget xunit.categories 2.0.6
nuget Moq 4.17.2

nuget Serilog 2.10.0
nuget Serilog.Settings.Configuration 3.3.0
Expand Down
152 changes: 151 additions & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ NUGET
Be.Vlaanderen.Basisregisters.NisCodeService.Abstractions (1.3.4)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Logging.Abstractions (>= 6.0.3)
Be.Vlaanderen.Basisregisters.NisCodeService.HardCoded (1.3.4)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Logging.Abstractions (>= 6.0.3)
Be.Vlaanderen.Basisregisters.ProblemDetails (8.0.1)
System.Reflection.Metadata (>= 6.0.1)
Be.Vlaanderen.Basisregisters.Shaperon (9.0.1)
Expand All @@ -227,6 +230,17 @@ NUGET
BlackFox.VsWhere (1.1)
FSharp.Core (>= 4.2.3)
Microsoft.Win32.Registry (>= 4.7)
Castle.Core (4.4.1)
NETStandard.Library (>= 1.6.1)
System.Collections.Specialized (>= 4.3)
System.ComponentModel (>= 4.3)
System.ComponentModel.TypeConverter (>= 4.3)
System.Diagnostics.TraceSource (>= 4.3)
System.Dynamic.Runtime (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Emit (>= 4.3)
System.Reflection.TypeExtensions (>= 4.3)
System.Xml.XmlDocument (>= 4.3)
Confluent.Kafka (2.3)
librdkafka.redist (>= 2.3)
System.Memory (>= 4.5)
Expand Down Expand Up @@ -690,6 +704,9 @@ NUGET
Microsoft.Win32.SystemEvents (4.7)
Microsoft.NETCore.Platforms (>= 3.1)
Mono.Posix.NETStandard (1.0)
Moq (4.17.2)
Castle.Core (>= 4.4.1)
System.Threading.Tasks.Extensions (>= 4.5.4)
MSBuild.StructuredLogger (2.1.545)
Microsoft.Build (>= 16.10)
Microsoft.Build.Framework (>= 16.10)
Expand Down Expand Up @@ -780,6 +797,9 @@ NUGET
NuGet.Versioning (6.7)
Parlot (0.0.23)
Polly (7.2.3)
runtime.native.System (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
Scrutor (3.0.1)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
Microsoft.Extensions.DependencyModel (>= 2.1)
Expand Down Expand Up @@ -839,6 +859,43 @@ NUGET
System.Runtime (>= 4.3)
System.Collections.Immutable (6.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Collections.NonGeneric (4.3)
System.Diagnostics.Debug (>= 4.3)
System.Globalization (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Collections.Specialized (4.3)
System.Collections.NonGeneric (>= 4.3)
System.Globalization (>= 4.3)
System.Globalization.Extensions (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.ComponentModel (4.3)
System.Runtime (>= 4.3)
System.ComponentModel.Primitives (4.3)
System.ComponentModel (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.ComponentModel.TypeConverter (4.3)
System.Collections (>= 4.3)
System.Collections.NonGeneric (>= 4.3)
System.Collections.Specialized (>= 4.3)
System.ComponentModel (>= 4.3)
System.ComponentModel.Primitives (>= 4.3)
System.Globalization (>= 4.3)
System.Linq (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Extensions (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Reflection.TypeExtensions (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Configuration.ConfigurationManager (4.7)
System.Security.Cryptography.ProtectedData (>= 4.7)
System.Security.Permissions (>= 4.7)
Expand All @@ -858,14 +915,46 @@ NUGET
System.Diagnostics.DiagnosticSource (6.0.1)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Diagnostics.EventLog (6.0)
System.Diagnostics.TraceSource (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
runtime.native.System (>= 4.3)
System.Collections (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Globalization (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Drawing.Common (4.7)
Microsoft.NETCore.Platforms (>= 3.1)
Microsoft.Win32.SystemEvents (>= 4.7)
System.Dynamic.Runtime (4.3)
System.Collections (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Linq (>= 4.3)
System.Linq.Expressions (>= 4.3)
System.ObjectModel (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Emit (>= 4.3)
System.Reflection.Emit.ILGeneration (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Reflection.TypeExtensions (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Formats.Asn1 (6.0)
System.Globalization (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Globalization.Extensions (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
System.Globalization (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Runtime.InteropServices (>= 4.3)
System.IdentityModel.Tokens.Jwt (6.10)
Microsoft.IdentityModel.JsonWebTokens (>= 6.10)
Microsoft.IdentityModel.Tokens (>= 6.10)
Expand Down Expand Up @@ -893,21 +982,68 @@ NUGET
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Linq.Expressions (4.3)
System.Collections (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Globalization (>= 4.3)
System.IO (>= 4.3)
System.Linq (>= 4.3)
System.ObjectModel (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Emit (>= 4.3)
System.Reflection.Emit.ILGeneration (>= 4.3)
System.Reflection.Emit.Lightweight (>= 4.3)
System.Reflection.Extensions (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Reflection.TypeExtensions (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Memory (4.5.5)
System.Numerics.Vectors (4.5)
System.ObjectModel (4.3)
System.Collections (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Threading (>= 4.3)
System.Reactive (5.0)
System.Reflection (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.IO (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Emit (4.3)
System.IO (>= 4.3)
System.Reflection (>= 4.3)
System.Reflection.Emit.ILGeneration (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Emit.ILGeneration (4.3)
System.Reflection (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Emit.Lightweight (4.3)
System.Reflection (>= 4.3)
System.Reflection.Emit.ILGeneration (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Extensions (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Reflection (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Metadata (6.0.1)
System.Collections.Immutable (>= 6.0)
System.Reflection.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Reflection.TypeExtensions (4.3)
System.Reflection (>= 4.3)
System.Runtime (>= 4.3)
System.Resources.Extensions (4.6)
System.Resources.ResourceManager (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Expand Down Expand Up @@ -968,12 +1104,15 @@ NUGET
System.Text.Encodings.Web (>= 6.0)
System.Text.RegularExpressions (4.3)
System.Runtime (>= 4.3)
System.Threading (4.3)
System.Runtime (>= 4.3)
System.Threading.Tasks (>= 4.3)
System.Threading.Tasks (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Threading.Tasks.Dataflow (6.0)
System.Threading.Tasks.Extensions (4.5.2)
System.Threading.Tasks.Extensions (4.5.4)
System.Windows.Extensions (4.7)
System.Drawing.Common (>= 4.7)
System.Xml.ReaderWriter (4.3)
Expand All @@ -992,6 +1131,17 @@ NUGET
System.Text.RegularExpressions (>= 4.3)
System.Threading.Tasks (>= 4.3)
System.Threading.Tasks.Extensions (>= 4.3)
System.Xml.XmlDocument (4.3)
System.Collections (>= 4.3)
System.Diagnostics.Debug (>= 4.3)
System.Globalization (>= 4.3)
System.IO (>= 4.3)
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.Extensions (>= 4.3)
System.Text.Encoding (>= 4.3)
System.Threading (>= 4.3)
System.Xml.ReaderWriter (>= 4.3)
TimeZoneConverter (3.5)
xunit (2.4.1)
xunit.analyzers (>= 0.10)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
namespace Basisregisters.IntegrationDb.SuspiciousCases.Api.Infrastructure.Modules
{
using System.Collections.Generic;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Auth.AcmIdm;
using Be.Vlaanderen.Basisregisters.Api.Exceptions;
using Be.Vlaanderen.Basisregisters.Auth;
using Be.Vlaanderen.Basisregisters.Auth.AcmIdm;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Microsoft;
using Be.Vlaanderen.Basisregisters.DependencyInjection;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NisCodeService.HardCoded.Extensions;

public class ApiModule : Module
{
Expand Down Expand Up @@ -40,6 +42,11 @@ protected override void Load(ContainerBuilder builder)

_services.AddAcmIdmAuthorizationHandlers();

var ovoCodeWhiteList = _configuration.GetSection("OvoCodeWhiteList").Get<List<string>>();
_services
.AddHardCodedNisCodeService()
.AddOvoCodeWhiteList(ovoCodeWhiteList);

builder.Populate(_services);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
private readonly IConfiguration _configuration;
private readonly ILoggerFactory _loggerFactory;

public Startup(

Check warning on line 35 in src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs

View workflow job for this annotation

GitHub Actions / Build

Non-nullable field '_applicationContainer' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
IConfiguration configuration,
ILoggerFactory loggerFactory)
{
Expand Down Expand Up @@ -106,8 +106,8 @@
}
}
.EnableJsonErrorActionFilterOption())
.Configure<ResponseOptions>(_configuration.GetSection("ResponseOptions"));
//.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
.Configure<ResponseOptions>(_configuration.GetSection("ResponseOptions"))
.AddSingleton<IActionContextAccessor, ActionContextAccessor>(); // Used to retrieve the authenticated user claims.

var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterModule(new ApiModule(_configuration, services, _loggerFactory));
Expand Down
Loading
Loading