Skip to content
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
4 changes: 4 additions & 0 deletions EstateManagement.IntegrationTests/Contract/Contract.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Background:
| RoleName |
| Estate |

Given I create the following api scopes
| Name | DisplayName | Description |
| estateManagement | Estate Managememt REST Scope | A scope for Estate Managememt REST |

Given the following api resources exist
| ResourceName | DisplayName | Secret | Scopes | UserClaims |
| estateManagement | Estate Managememt REST | Secret1 | estateManagement | MerchantId, EstateId, role |
Expand Down
930 changes: 3 additions & 927 deletions EstateManagement.IntegrationTests/Contract/Contract.feature.cs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions EstateManagement.IntegrationTests/Estate/Estate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Background:
| RoleName |
| Estate |

Given I create the following api scopes
| Name | DisplayName | Description |
| estateManagement | Estate Managememt REST Scope | A scope for Estate Managememt REST |

Given the following api resources exist
| ResourceName | DisplayName | Secret | Scopes | UserClaims |
| estateManagement | Estate Managememt REST | Secret1 | estateManagement | MerchantId, EstateId, role |
Expand Down
235 changes: 123 additions & 112 deletions EstateManagement.IntegrationTests/Estate/Estate.feature.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NLog" Version="4.7.6" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.7.0" />
<PackageReference Include="SecurityService.Client" Version="1.0.4" />
<PackageReference Include="SecurityService.Client" Version="1.0.4.1" />
<PackageReference Include="Shared" Version="1.0.3" />
<PackageReference Include="Shared.IntegrationTesting" Version="1.0.3" />
<PackageReference Include="Shouldly" Version="4.0.3" />
Expand Down
4 changes: 4 additions & 0 deletions EstateManagement.IntegrationTests/Merchant/Merchant.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Background:
| Estate |
| Merchant |

Given I create the following api scopes
| Name | DisplayName | Description |
| estateManagement | Estate Managememt REST Scope | A scope for Estate Managememt REST |

Given the following api resources exist
| ResourceName | DisplayName | Secret | Scopes | UserClaims |
| estateManagement | Estate Managememt REST | Secret1 | estateManagement | MerchantId, EstateId, role |
Expand Down
268 changes: 134 additions & 134 deletions EstateManagement.IntegrationTests/Merchant/Merchant.feature.cs

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions EstateManagement.IntegrationTests/Shared/SharedSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,31 @@ public async Task ThenTheMerchantBalancesAreAsFollows(Table table)
}
}

[Given(@"I create the following api scopes")]
public async Task GivenICreateTheFollowingApiScopes(Table table)
{
foreach (TableRow tableRow in table.Rows)
{
CreateApiScopeRequest createApiScopeRequest = new CreateApiScopeRequest
{
Name = SpecflowTableHelper.GetStringRowValue(tableRow, "Name"),
Description = SpecflowTableHelper.GetStringRowValue(tableRow, "Description"),
DisplayName = SpecflowTableHelper.GetStringRowValue(tableRow, "DisplayName")
};
var createApiScopeResponse =
await this.CreateApiScope(createApiScopeRequest, CancellationToken.None).ConfigureAwait(false);

createApiScopeResponse.ShouldNotBeNull();
createApiScopeResponse.ApiScopeName.ShouldNotBeNullOrEmpty();
}
}

private async Task<CreateApiScopeResponse> CreateApiScope(CreateApiScopeRequest createApiScopeRequest,
CancellationToken cancellationToken)
{
CreateApiScopeResponse createApiScopeResponse = await this.TestingContext.DockerHelper.SecurityServiceClient.CreateApiScope(createApiScopeRequest, cancellationToken).ConfigureAwait(false);
return createApiScopeResponse;
}

[Given(@"the following api resources exist")]
public async Task GivenTheFollowingApiResourcesExist(Table table)
Expand Down
1 change: 0 additions & 1 deletion EstateManagement/Common/ClaimsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Claims;
using IdentityModel;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Shared.Exceptions;

Expand Down
2 changes: 1 addition & 1 deletion EstateManagement/EstateManagement.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.2.0" />
Expand Down
3 changes: 1 addition & 2 deletions EstateManagement/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace EstateManagement
using EstateReporting.Database;
using EventStore.Client;
using HealthChecks.UI.Client;
using IdentityModel.AspNetCore.OAuth2Introspection;
using MediatR;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -293,7 +292,7 @@ private void ConfigureMiddlewareServices(IServiceCollection services)
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateAudience = false,
ValidAudience = ConfigurationReader.GetValue("SecurityConfiguration", "ApiName"),
ValidIssuer = ConfigurationReader.GetValue("SecurityConfiguration", "Authority"),
};
Expand Down