Skip to content

Commit

Permalink
tests: add tests for mandatoryIdentityClaimHandler
Browse files Browse the repository at this point in the history
Refs: CPLP-3102
  • Loading branch information
Phil91 committed Nov 30, 2023
1 parent fa7a53c commit 47f9b96
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 265 deletions.
15 changes: 0 additions & 15 deletions src/Portal.Backend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Linq", "framework
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Linq.Tests", "..\tests\framework\Framework.Linq.Tests\Framework.Linq.Tests.csproj", "{4B40193E-2C67-4DC4-8EF4-3286DAA01D8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Authorization", "framework\Framework.Authorization\Framework.Authorization.csproj", "{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Models.Tests", "..\tests\framework\Framework.Models.Tests\Framework.Models.Tests.csproj", "{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.ProcessIdentity", "framework\Framework.ProcessIdentity\Framework.ProcessIdentity.csproj", "{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}"
Expand Down Expand Up @@ -1284,18 +1282,6 @@ Global
{4B40193E-2C67-4DC4-8EF4-3286DAA01D8B}.Release|x64.Build.0 = Release|Any CPU
{4B40193E-2C67-4DC4-8EF4-3286DAA01D8B}.Release|x86.ActiveCfg = Release|Any CPU
{4B40193E-2C67-4DC4-8EF4-3286DAA01D8B}.Release|x86.Build.0 = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|x64.Build.0 = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Debug|x86.Build.0 = Debug|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|Any CPU.Build.0 = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|x64.ActiveCfg = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|x64.Build.0 = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|x86.ActiveCfg = Release|Any CPU
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6}.Release|x86.Build.0 = Release|Any CPU
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -1635,7 +1621,6 @@ Global
{EC493B36-9E14-4CAF-973F-FB96FDAF546F} = {A878BDF1-6DB6-4BA5-A724-92885A710856}
{1694E75F-ABCE-4573-B805-18ED50F148FD} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{031237BF-7B2A-4B37-9E37-4D4C575FDD22} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{47E089E3-E875-4045-9E58-C1223BE899E9} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{9D574E57-75A6-4965-AF23-ACE0BB9CD0B3} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
Expand Down
70 changes: 0 additions & 70 deletions src/framework/Framework.Authorization/ClaimRequestPathHandler.cs

This file was deleted.

This file was deleted.

This file was deleted.

59 changes: 0 additions & 59 deletions src/framework/Framework.Authorization/MandatoryGuidClaimHandler.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<ProjectReference Include="..\Framework.DateTimeProvider\Framework.DateTimeProvider.csproj" />
<ProjectReference Include="..\Framework.ErrorHandling.Web\Framework.ErrorHandling.Web.csproj" />
<ProjectReference Include="..\Framework.Swagger\Framework.Swagger.csproj" />
<ProjectReference Include="..\Framework.Authorization\Framework.Authorization.csproj" />
<ProjectReference Include="..\Framework.Linq\Framework.Linq.csproj" />
<ProjectReference Include="..\Framework.Logging\Framework.Logging.csproj" />
</ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/framework/Framework.Web/Framework.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<ProjectReference Include="..\Framework.ProcessIdentity\Framework.ProcessIdentity.csproj" />
<ProjectReference Include="..\Framework.PublicInfos\Framework.PublicInfos.csproj" />
<ProjectReference Include="..\Framework.Swagger\Framework.Swagger.csproj" />
<ProjectReference Include="..\Framework.Authorization\Framework.Authorization.csproj" />
<ProjectReference Include="..\Framework.Linq\Framework.Linq.csproj" />
<ProjectReference Include="..\Framework.Logging\Framework.Logging.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@
********************************************************************************/

using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Microsoft.Extensions.Logging;

namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Authorization
namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Web
{
public class MandatoryIdentityClaimRequirement : IAuthorizationRequirement
{
private readonly PolicyTypeId _policyTypeId;

public MandatoryIdentityClaimRequirement(PolicyTypeId policyTypeId)
{
_policyTypeId = policyTypeId;
PolicyTypeId = policyTypeId;
}

public PolicyTypeId PolicyTypeId { get => _policyTypeId; }
public PolicyTypeId PolicyTypeId { get; }
}

public class MandatoryIdentityClaimHandler : AuthorizationHandler<MandatoryIdentityClaimRequirement>
Expand Down Expand Up @@ -71,7 +69,7 @@ protected override Task HandleRequirementAsync(AuthorizationHandlerContext conte
}
catch (Exception e)
{
_logger.LogInformation("unable to retrieve IdentityData", e);
_logger.LogInformation(e, "unable to retrieve IdentityData");
context.Fail();
}
return Task.CompletedTask;
Expand Down
1 change: 0 additions & 1 deletion src/framework/Framework.Web/StartupServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Authorization;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Cors;
using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider.DependencyInjection;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!--
- Copyright (c) 2021, 2023 BMW Group AG
- Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
-
- See the NOTICE file(s) distributed with this work for additional
Expand Down
Loading

0 comments on commit 47f9b96

Please sign in to comment.