Skip to content

Commit

Permalink
feat: add roles for technical user
Browse files Browse the repository at this point in the history
Refs: #112
  • Loading branch information
Phil91 committed Oct 11, 2024
1 parent f0cf01e commit 48a5731
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Dim.Clients.Api.Div.Models;
Expand All @@ -30,7 +32,12 @@ public record ServiceKeyOperationCreationRequest(

public record ServiceKeyCreationPayloadData(
[property: JsonPropertyName("customerWalletId")] Guid CustomerWalletId,
[property: JsonPropertyName("divWalletServiceName")] string ServiceKeyName
[property: JsonPropertyName("divWalletServiceName")] string ServiceKeyName,
[property: JsonPropertyName("divWalletServiceParameter")] ServiceKeyParameter Parameter
);

public record ServiceKeyParameter(
[property: JsonPropertyName("authorities")] IEnumerable<string> Authorities
);

public record ServiceKeyOperationDeletionRequest(
Expand Down
7 changes: 6 additions & 1 deletion src/clients/Dim.Clients/Api/Div/ProvisioningClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
using Microsoft.Extensions.Options;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions;
using System;
using System.Linq;
using System.Net.Http.Json;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

namespace Dim.Clients.Api.Div;

Expand Down Expand Up @@ -138,7 +142,8 @@ public async Task<Guid> CreateServiceKey(string technicalUserName, Guid walletId
"create",
new ServiceKeyCreationPayloadData(
walletId,
technicalUserName
technicalUserName,
new ServiceKeyParameter(new[] { "IatpOperations", "ReadCompanyIdentity", "ResolveDID" })
)
);
var client = await basicAuthTokenService
Expand Down
4 changes: 4 additions & 0 deletions src/clients/Dim.Clients/Token/IBasicAuthTokenService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace Dim.Clients.Token;

public interface IBasicAuthTokenService
Expand Down

0 comments on commit 48a5731

Please sign in to comment.