Skip to content

Commit

Permalink
build(v2.0.0-RC4): merge main into dev #680
Browse files Browse the repository at this point in the history
Reviewed-By: Evelyn Gurschler <[email protected]>
  • Loading branch information
Phil91 authored Apr 24, 2024
2 parents 5d24cab + ce2af5c commit f43a1ee
Show file tree
Hide file tree
Showing 49 changed files with 10,457 additions and 57 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend.

## 2.0.0-RC4

### Changes
* **Administration Service**
* adjusted GET: api/administration/adjust response of companydata/decentralidentity/urls to response the correct urls

### Feature
* **Backend Logic**
* added auditing for certificate management
* **Apps Service**
* added GET: /api/apps/AppChange/{appId}/roles to receive the roles for a specific app

### Bugfix
* **Process Worker**
* set the correct state for IDENTITY_WALLET application step after all steps are done

## 2.0.0-RC3

### Changes
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>RC3</VersionSuffix>
<VersionSuffix>RC4</VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,10 @@ public async IAsyncEnumerable<CompanyCertificateBpnData> GetCompanyCertificatesB
_portalRepositories.GetInstance<ICompanyCertificateRepository>().GetActiveCompanyCertificatePaginationSource(sorting, certificateStatus, certificateType, _identityData.CompanyId));

public async Task<DimUrlsResponse> GetDimServiceUrls() =>
new DimUrlsResponse(
_settings.DecentralIdentityManagementAuthUrl,
await _portalRepositories.GetInstance<ICompanyRepository>().GetWalletServiceUrl(_identityData.CompanyId).ConfigureAwait(ConfigureAwaitOptions.None));
new(
$"{await _portalRepositories.GetInstance<ICompanyRepository>().GetWalletServiceUrl(_identityData.CompanyId).ConfigureAwait(ConfigureAwaitOptions.None)}/oauth/token",
_settings.DecentralIdentityManagementAuthUrl
);

/// <inheritdoc />
public async Task<int> DeleteCompanyCertificateAsync(Guid documentId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;

public record DimUrlsResponse(
string DecentralIdentityManagementAuthUrl,
string? DecentralIdentityManagementServiceUrl
string? DecentralIdentityManagementAuthUrl,
string DecentralIdentityManagementServiceUrl
);
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public static IServiceCollection AddBpdmService(this IServiceCollection services

var sp = services.BuildServiceProvider();
var settings = sp.GetRequiredService<IOptions<BpdmServiceSettings>>();
var baseAddress = settings.Value.BaseAddress;
services
.AddCustomHttpClientWithAuthentication<BpdmService>(settings.Value.BaseAddress)
.AddCustomHttpClientWithAuthentication<BpdmService>(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/")
.AddTransient<IBpdmService, BpdmService>()
.AddTransient<IBpdmBusinessLogic, BpdmBusinessLogic>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<bool> TransmitDidAndBpn(string did, string bpn, CancellationTo
{
using var httpClient = httpClientFactory.CreateClient(nameof(BpnDidResolverService));
var data = new BpnMappingData(bpn, did);
var result = await httpClient.PostAsJsonAsync("/api/management/bpn-directory", data, Options, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
var result = await httpClient.PostAsJsonAsync("api/management/bpn-directory", data, Options, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
return result.IsSuccessStatusCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public BpnDidResolverBusinessLogic(IPortalRepositories portalRepositories, IBpnD
ProcessStepStatusId.DONE,
checklist =>
{
checklist.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.IN_PROGRESS;
checklist.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.DONE;
},
[ProcessStepTypeId.REQUEST_BPN_CREDENTIAL],
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public static IServiceCollection AddBpnDidResolver(this IServiceCollection servi
var settings = sp.GetRequiredService<IOptions<BpnDidResolverSettings>>();
services.AddHttpClient(nameof(BpnDidResolverService), c =>
{
c.BaseAddress = new Uri(settings.Value.BaseAddress);
var baseAddress = settings.Value.BaseAddress;
c.BaseAddress = new Uri(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/");
c.DefaultRequestHeaders.Add("X-Api-Key", settings.Value.ApiKey);
});
services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public static IServiceCollection AddClearinghouseService(this IServiceCollection

var sp = services.BuildServiceProvider();
var settings = sp.GetRequiredService<IOptions<ClearinghouseSettings>>();
var baseAddress = settings.Value.BaseAddress;
services
.AddCustomHttpClientWithAuthentication<ClearinghouseService>(settings.Value.BaseAddress)
.AddCustomHttpClientWithAuthentication<ClearinghouseService>(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/")
.AddTransient<IClearinghouseService, ClearinghouseService>()
.AddTransient<IClearinghouseBusinessLogic, ClearinghouseBusinessLogic>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static IServiceCollection AddCustodianService(this IServiceCollection ser

var sp = services.BuildServiceProvider();
var settings = sp.GetRequiredService<IOptions<CustodianSettings>>();
services.AddCustomHttpClientWithAuthentication<CustodianService>(settings.Value.BaseAddress);
var baseAddress = settings.Value.BaseAddress;
services.AddCustomHttpClientWithAuthentication<CustodianService>(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/");
services
.AddTransient<ICustodianService, CustodianService>()
.AddTransient<ICustodianBusinessLogic, CustodianBusinessLogic>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static IServiceCollection AddDimService(this IServiceCollection services,

var sp = services.BuildServiceProvider();
var settings = sp.GetRequiredService<IOptions<DimSettings>>();
services.AddCustomHttpClientWithAuthentication<DimService>(settings.Value.BaseAddress);
var baseAddress = settings.Value.BaseAddress;
services.AddCustomHttpClientWithAuthentication<DimService>(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/");

RegisterUniversalResolver(settings.Value, services);
services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async Task StoreBpnlCredentialResponse(Guid applicationId, IssuerResponse

checklistService.FinalizeChecklistEntryAndProcessSteps(
context,
null,
item => item.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.IN_PROGRESS,
item =>
{
item.ApplicationChecklistEntryStatusId = data.Status == IssuerResponseStatus.UNSUCCESSFUL
Expand Down Expand Up @@ -162,7 +162,7 @@ public async Task StoreMembershipCredentialResponse(Guid applicationId, IssuerRe

checklistService.FinalizeChecklistEntryAndProcessSteps(
context,
null,
item => item.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.IN_PROGRESS,
item =>
{
item.ApplicationChecklistEntryStatusId = data.Status == IssuerResponseStatus.UNSUCCESSFUL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public static IServiceCollection AddIssuerComponentService(this IServiceCollecti

var sp = services.BuildServiceProvider();
var settings = sp.GetRequiredService<IOptions<IssuerComponentSettings>>();
services.AddCustomHttpClientWithAuthentication<IssuerComponentService>(settings.Value.BaseAddress);
var baseAddress = settings.Value.BaseAddress;
services.AddCustomHttpClientWithAuthentication<IssuerComponentService>(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/");
services
.AddTransient<IIssuerComponentService, IssuerComponentService>()
.AddTransient<IIssuerComponentBusinessLogic, IssuerComponentBusinessLogic>();
Expand Down
2 changes: 1 addition & 1 deletion src/framework/Framework.Async/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Cors/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.DBAccess/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static IServiceCollection AddCustomHttpClientWithAuthentication<T>(this I
{
if (baseAddress != null)
{
c.BaseAddress = new Uri(baseAddress.EndsWith('/') ? baseAddress : $"{baseAddress}/");
c.BaseAddress = new Uri(baseAddress);
}
}).AddHttpMessageHandler<LoggingHandler<T>>();

Expand Down
2 changes: 1 addition & 1 deletion src/framework/Framework.IO/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Linq/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Logging/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Models/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Seeding/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Swagger/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Token/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Web/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public async Task CreateActiveAppDocumentAsync(Guid appId, DocumentTypeId docume
/// <inheritdoc />
public async Task<IEnumerable<ActiveAppRoleDetails>> GetActiveAppRolesAsync(Guid appId, string? languageShortName)
{
var (isValid, isActive, roleDetails) = await _portalRepositories.GetInstance<IUserRolesRepository>().GetActiveAppRolesAsync(appId, OfferTypeId.APP, languageShortName, Constants.DefaultLanguage).ConfigureAwait(ConfigureAwaitOptions.None);
var (isValid, isActive, roleDetails) = await _portalRepositories.GetInstance<IUserRolesRepository>().GetActiveOfferRolesAsync(appId, OfferTypeId.APP, languageShortName, Constants.DefaultLanguage).ConfigureAwait(ConfigureAwaitOptions.None);
if (!isValid)
{
throw new NotFoundException($"App {appId} does not exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,19 @@ public Task<IEnumerable<TechnicalUserProfileInformation>> GetTechnicalUserProfil
/// <inheritdoc />
public Task UpdateTechnicalUserProfiles(Guid appId, IEnumerable<TechnicalUserProfileData> data) =>
_offerService.UpdateTechnicalUserProfiles(appId, OfferTypeId.APP, data, _settings.TechnicalUserProfileClient);

/// <inheritdoc />
public async Task<IEnumerable<ActiveAppRoleDetails>> GetAppProviderRolesAsync(Guid appId, string? languageShortName)
{
var (isValid, isProvider, roleDetails) = await _portalRepositories.GetInstance<IUserRolesRepository>().GetOfferProviderRolesAsync(appId, OfferTypeId.APP, _identityData.CompanyId, languageShortName, Constants.DefaultLanguage).ConfigureAwait(ConfigureAwaitOptions.None);
if (!isValid)
{
throw new NotFoundException($"App {appId} does not exist");
}
if (!isProvider)
{
throw new ForbiddenException($"Company {_identityData.CompanyId} is not the provider company");
}
return roleDetails ?? throw new UnexpectedConditionException("roleDetails should never be null here");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,11 @@ public interface IAppReleaseBusinessLogic
/// <param name="appId">Id of the app</param>
/// <param name="data">The technical user profiles</param>
Task UpdateTechnicalUserProfiles(Guid appId, IEnumerable<TechnicalUserProfileData> data);

/// <summary>
/// Get an user roles for an app provider
/// </summary>
/// <param name="appId">Id of the app</param>
/// <param name="languageShortName"></param>
Task<IEnumerable<ActiveAppRoleDetails>> GetAppProviderRolesAsync(Guid appId, string? languageShortName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,22 @@ public async Task<NoContentResult> CreateAndUpdateTechnicalUserProfiles([FromRou
await _appReleaseBusinessLogic.UpdateTechnicalUserProfiles(appId, data).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}

/// <summary>
/// Gets the app providers an overview of configures app roles.
/// </summary>
/// <param name="appId" example="D3B1ECA2-6148-4008-9E6C-C1C2AEA5C645">Id of the app which roles should be returned.</param>
/// <param name="languageShortName">OPTIONAL: The language short name.</param>
/// <returns>Returns the app providers an overview of configures app roles.</returns>
/// <remarks>Example: GET: /api/apps/AppChange/D3B1ECA2-6148-4008-9E6C-C1C2AEA5C645/roles</remarks>
/// <response code="200">Returns the client roles.</response>
/// <response code="404">The app was not found.</response>
/// <response code="403">The app is not the provider of the company</response>
[HttpGet]
[Authorize(Roles = "view_client_roles")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("{appId}/roles")]
[ProducesResponseType(typeof(IEnumerable<ActiveAppRoleDetails>), StatusCodes.Status200OK)]
public Task<IEnumerable<ActiveAppRoleDetails>> GetAppProviderRolesAsync([FromRoute] Guid appId, [FromQuery] string? languageShortName = null) =>
_appReleaseBusinessLogic.GetAppProviderRolesAsync(appId, languageShortName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@ public interface IUserRolesRepository
/// <param name="offerId"></param>
/// <param name="languageShortName"></param>
/// <returns></returns>
Task<(bool IsValid, bool IsActive, IEnumerable<ActiveAppRoleDetails>? AppRoleDetails)> GetActiveAppRolesAsync(Guid offerId, OfferTypeId offerTypeId, string? languageShortName, string defaultLanguageShortName);
Task<(bool IsValid, bool IsActive, IEnumerable<ActiveAppRoleDetails>? AppRoleDetails)> GetActiveOfferRolesAsync(Guid offerId, OfferTypeId offerTypeId, string? languageShortName, string defaultLanguageShortName);

/// <summary>
/// Gets userRoles for an app provider
/// </summary>
/// <param name="offerId"></param>
/// <param name="languageShortName"></param>
/// <returns></returns>
Task<(bool IsValid, bool IsProvider, IEnumerable<ActiveAppRoleDetails>? AppRoleDetails)> GetOfferProviderRolesAsync(Guid offerId, OfferTypeId offerTypeId, Guid companyId, string? languageShortName, string defaultLanguageShortName);
}
Loading

0 comments on commit f43a1ee

Please sign in to comment.