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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.14" />
<PackageReference Include="Shared" Version="2025.1.1" />
<PackageReference Include="Shared.Results" Version="2025.1.1" />
<PackageReference Include="Shared" Version="2025.5.4" />
<PackageReference Include="Shared.Results" Version="2025.5.4" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions SecurityService.Client/SecurityService.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="2025.1.1" />
<PackageReference Include="Shared.Results" Version="2025.1.1" />
<PackageReference Include="ClientProxyBase" Version="2025.5.4" />
<PackageReference Include="Shared.Results" Version="2025.5.4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion SecurityService.Database/SecurityService.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="Shared" Version="2025.1.1" />
<PackageReference Include="Shared" Version="2025.5.4" />
</ItemGroup>
<ItemGroup>
<Folder Include="DbContexts\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!--<PackageReference Include="Reqnroll.Tools.MsBuild.Generation" Version="1.0.1" />
<PackageReference Include="Reqnroll.xUnit" Version="1.0.1" />-->
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.1.1" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.5.4" />
<!--<PackageReference Include="Shouldly" Version="4.2.1" />-->
<!--<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
78 changes: 51 additions & 27 deletions SecurityService.IntegrationTesting.Helpers/SecurityServiceSteps.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageReference Include="Reqnroll.NUnit" Version="2.4.0" />

<PackageReference Include="Shared.IntegrationTesting" Version="2025.1.1" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.5.4" />
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.14" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ protected async Task DoTestUIHealthCheck()
await Retry.For(async () => {
this.Trace($"About to do health check for Test UI");

String healthCheck =
SimpleResults.Result<String> healthCheck =
await this.HealthCheckClient.PerformHealthCheck("https", "127.0.0.1", this.SecurityServiceTestUIPort, CancellationToken.None);

HealthCheckResult result = JsonConvert.DeserializeObject<HealthCheckResult>(healthCheck);
healthCheck.IsSuccess.ShouldBeTrue($"Health check for Test UI failed with [{healthCheck.Message}]");
HealthCheckResult result = JsonConvert.DeserializeObject<HealthCheckResult>(healthCheck.Data);

this.Trace($"health check complete for Test UI result is [{healthCheck}]");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using SimpleResults;

namespace SecurityService.OpenIdConnect.IntegrationTests.Common
{
Expand Down Expand Up @@ -76,10 +77,11 @@ public async Task GivenICreateTheFollowingApiResources(DataTable table)
private async Task CreateIdentityResource(CreateIdentityResourceRequest createIdentityResourceRequest,
CancellationToken cancellationToken)
{
List<IdentityResourceDetails> identityResourceList = await this.TestingContext.DockerHelper.SecurityServiceClient.GetIdentityResources(cancellationToken);

Result<List<IdentityResourceDetails>> identityResourceListResult = await this.TestingContext.DockerHelper.SecurityServiceClient.GetIdentityResources(cancellationToken);
identityResourceListResult.IsSuccess.ShouldBeTrue();
List<IdentityResourceDetails> identityResourceList = identityResourceListResult.Data;
if (identityResourceList == null || identityResourceList.Any() == false) {
var result = await this.TestingContext.DockerHelper.SecurityServiceClient.CreateIdentityResource(createIdentityResourceRequest, cancellationToken).ConfigureAwait(false);
Result result = await this.TestingContext.DockerHelper.SecurityServiceClient.CreateIdentityResource(createIdentityResourceRequest, cancellationToken).ConfigureAwait(false);
result.IsSuccess.ShouldBeTrue();

this.TestingContext.IdentityResources.Add(createIdentityResourceRequest.Name);
Expand All @@ -91,7 +93,7 @@ private async Task CreateIdentityResource(CreateIdentityResourceRequest createId
return;
}

var result = await this
Result result = await this
.TestingContext.DockerHelper.SecurityServiceClient
.CreateIdentityResource(createIdentityResourceRequest, cancellationToken)
.ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<PackageReference Include="Selenium.Support" Version="4.29.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.29.0" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.1.1" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.5.4" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Shared" Version="2025.1.1" />
<PackageReference Include="Shared" Version="2025.5.4" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions SecurityService/Controllers/ApiResourceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Shared.Results;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
Expand Down Expand Up @@ -82,13 +83,12 @@ public async Task<IActionResult> GetApiResource([FromRoute] String apiResourceNa
{
SecurityServiceQueries.GetApiResourceQuery query = new(apiResourceName);

var result= await this.Mediator.Send(query, cancellationToken);
// TODO:: handle failure
Result<ApiResource> result= await this.Mediator.Send(query, cancellationToken);
// return the result
if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
ApiResourceDetails model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand All @@ -105,12 +105,12 @@ public async Task<IActionResult> GetApiResource([FromRoute] String apiResourceNa
public async Task<IActionResult> GetApiResources(CancellationToken cancellationToken) {
SecurityServiceQueries.GetApiResourcesQuery query = new SecurityServiceQueries.GetApiResourcesQuery();

var result = await this.Mediator.Send(query, cancellationToken);
Result<List<ApiResource>> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<ApiResourceDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
10 changes: 6 additions & 4 deletions SecurityService/Controllers/ApiScopeController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using MediatR;
using SecurityService.BusinessLogic.RequestHandlers;
using SecurityService.BusinessLogic.Requests;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
Expand Down Expand Up @@ -50,8 +51,9 @@ public async Task<IActionResult> CreateApiScope([FromBody] CreateApiScopeRequest
createApiScopeRequest.DisplayName,
createApiScopeRequest.Description);

var result = await this.Mediator.Send(command, cancellationToken);
// TODO: Handle failed result
Result result = await this.Mediator.Send(command, cancellationToken);
if (result.IsFailed)
return result.ToActionResultX();

// return the result
return result.ToActionResultX();
Expand Down Expand Up @@ -94,12 +96,12 @@ public async Task<IActionResult> GetApiScopes(CancellationToken cancellationToke
{
SecurityServiceQueries.GetApiScopesQuery query = new();

var result = await this.Mediator.Send(query, cancellationToken);
Result<List<ApiScope>> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<ApiScopeDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
17 changes: 10 additions & 7 deletions SecurityService/Controllers/ClientController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SimpleResults;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
{
Expand Down Expand Up @@ -85,8 +86,10 @@ public async Task<IActionResult> CreateClient([FromBody] CreateClientRequest cre
createClientRequest.AllowOfflineAccess);

// Create the client
var result = await this.Mediator.Send(command, cancellationToken);
// TODO: handle failed result
Result result = await this.Mediator.Send(command, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

// return the result
return this.Created($"{ClientController.ControllerRoute}/{createClientRequest.ClientId}",
Expand All @@ -111,12 +114,12 @@ public async Task<IActionResult> GetClient([FromRoute] String clientId,
{
SecurityServiceQueries.GetClientQuery query = new(clientId);

var result= await this.Mediator.Send(query, cancellationToken);
Result<Duende.IdentityServer.Models.Client> result= await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
ClientDetails model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand All @@ -134,12 +137,12 @@ public async Task<IActionResult> GetClients(CancellationToken cancellationToken)
{
SecurityServiceQueries.GetClientsQuery query = new();

var result = await this.Mediator.Send(query, cancellationToken);
Result<List<Duende.IdentityServer.Models.Client>> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<ClientDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
12 changes: 7 additions & 5 deletions SecurityService/Controllers/IdentityResourceController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SimpleResults;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
{
Expand Down Expand Up @@ -80,8 +81,9 @@ public async Task<IActionResult> CreateIdentityResource([FromBody] CreateIdentit
createIdentityResourceRequest.ShowInDiscoveryDocument,
createIdentityResourceRequest.Claims);

var result = await this.Mediator.Send(command, cancellationToken);
// TODO: Handle failed result
Result result = await this.Mediator.Send(command, cancellationToken);
if (result.IsFailed)
return result.ToActionResultX();

// return the result
return this.Created($"{IdentityResourceController.ControllerRoute}/{createIdentityResourceRequest.Name}",
Expand Down Expand Up @@ -111,7 +113,7 @@ public async Task<IActionResult> GetIdentityResource([FromRoute] String identity
if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
IdentityResourceDetails model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand All @@ -133,7 +135,7 @@ public async Task<IActionResult> GetIdentityResources(CancellationToken cancella
if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<IdentityResourceDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
15 changes: 9 additions & 6 deletions SecurityService/Controllers/RoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Threading.Tasks;
using Shared.Results;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
Expand Down Expand Up @@ -61,8 +62,10 @@ public async Task<IActionResult> CreateRole([FromBody] CreateRoleRequest createR
Guid roleId = Guid.NewGuid();
SecurityServiceCommands.CreateRoleCommand command = new(roleId, createRoleRequest.RoleName);

var result = await this.Mediator.Send(command, cancellationToken);
// TODO: Handle failed result
Result result = await this.Mediator.Send(command, cancellationToken);
if (result.IsFailed)
return result.ToActionResultX();

// return the result
return result.ToActionResultX();
}
Expand All @@ -82,12 +85,12 @@ public async Task<IActionResult> GetRole([FromRoute] Guid roleId,
{
SecurityServiceQueries.GetRoleQuery query = new(roleId);

var result = await this.Mediator.Send(query, cancellationToken);
Result<Models.RoleDetails> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
RoleDetails model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand All @@ -106,12 +109,12 @@ public async Task<IActionResult> GetRoles(CancellationToken cancellationToken)
{
SecurityServiceQueries.GetRolesQuery query = new();

var result = await this.Mediator.Send(query, cancellationToken);
Result<List<Models.RoleDetails>> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<RoleDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
10 changes: 6 additions & 4 deletions SecurityService/Controllers/UserController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Shared.Results;
using Shared.Results.Web;
using SimpleResults;

namespace SecurityService.Controllers
Expand Down Expand Up @@ -81,7 +82,8 @@ public async Task<IActionResult> CreateUser([FromBody] CreateUserRequest createU

// Create the user
Result result = await this.Mediator.Send(command, cancellationToken);
// TODO: Handle failed result
if (result.IsFailed)
return result.ToActionResultX();

// return the result
return result.ToActionResultX();
Expand All @@ -102,12 +104,12 @@ public async Task<IActionResult> GetUser([FromRoute] Guid userId,
{
SecurityServiceQueries.GetUserQuery query = new(userId);

var result = await this.Mediator.Send(query, cancellationToken);
Result<Models.UserDetails> result = await this.Mediator.Send(query, cancellationToken);

if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
UserDetails model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand All @@ -133,7 +135,7 @@ public async Task<IActionResult> GetUsers([FromQuery] String userName,
if (result.IsFailed)
return result.ToActionResultX();

var model = this.ModelFactory.ConvertFrom(result.Data);
List<UserDetails> model = this.ModelFactory.ConvertFrom(result.Data);

return Result.Success(model).ToActionResultX();
}
Expand Down
2 changes: 2 additions & 0 deletions SecurityService/SecurityService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />

<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />

<PackageReference Include="Shared.Results.Web" Version="2025.5.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
Expand Down
2 changes: 1 addition & 1 deletion SecurityServiceTestUI/SecurityServiceTestUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.2" />
<PackageReference Include="Shared" Version="2025.1.1" />
<PackageReference Include="Shared" Version="2025.5.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading