Skip to content

Commit

Permalink
Merge pull request #1167 from eclipse-tractusx/merge/v2.3.0-RC3
Browse files Browse the repository at this point in the history
build(2.3.0-rc3): bump version and update docs
  • Loading branch information
evegufy authored Nov 20, 2024
2 parents 021985c + 68b83f0 commit e96edaa
Show file tree
Hide file tree
Showing 39 changed files with 613 additions and 181 deletions.
10 changes: 5 additions & 5 deletions .tractusx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

leadingRepository: "https://github.com/eclipse-tractusx/portal"
openApiSpecs:
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC2/docs/api/administration-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC2/docs/api/apps-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC2/docs/api/notifications-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC2/docs/api/registration-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC2/docs/api/services-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC3/docs/api/administration-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC3/docs/api/apps-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC3/docs/api/notifications-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC3/docs/api/registration-service.yaml"
- "https://raw.githubusercontent.com/eclipse-tractusx/portal-backend/refs/tags/v2.3.0-RC3/docs/api/services-service.yaml"
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ New features, fixed bugs, known defects and other noteworthy changes to each rel

## Unreleased

## 2.3.0-RC3

### Technical Support

* upgraded System.Text.Encodings.Web and System.Net.Http packages [#1156](https://github.com/eclipse-tractusx/portal-backend/pull/1156)

### Bugfixes

* **Keycloak realm seeding job**: added user profile and localization texts to seeding [#1154](https://github.com/eclipse-tractusx/portal-backend/pull/1154)
* **Own Identity Provider**: fixed setting URLs for IdP update [#1153](https://github.com/eclipse-tractusx/portal-backend/pull/1153)

## 2.3.0-RC2

### Change
Expand Down
2 changes: 1 addition & 1 deletion docs/api/administration-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: Org.Eclipse.TractusX.Portal.Backend.Administration.Service
version: v2.3.0-RC2
version: v2.3.0-RC3
paths:
/api/administration/companydata/ownCompanyDetails:
get:
Expand Down
2 changes: 1 addition & 1 deletion docs/api/apps-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: Org.Eclipse.TractusX.Portal.Backend.Apps.Service
version: v2.3.0-RC2
version: v2.3.0-RC3
paths:
'/api/apps/AppChange/{appId}/role/activeapp':
post:
Expand Down
2 changes: 1 addition & 1 deletion docs/api/notifications-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: Org.Eclipse.TractusX.Portal.Backend.Notifications.Service
version: v2.3.0-RC2
version: v2.3.0-RC3
paths:
/api/notification/errormessage:
get:
Expand Down
2 changes: 1 addition & 1 deletion docs/api/registration-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: Org.Eclipse.TractusX.Portal.Backend.Registration.Service
version: v2.3.0-RC2
version: v2.3.0-RC3
paths:
/api/registration/errormessage:
get:
Expand Down
2 changes: 1 addition & 1 deletion docs/api/services-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.1
info:
title: Org.Eclipse.TractusX.Portal.Backend.Services.Service
version: v2.3.0-RC2
version: v2.3.0-RC3
paths:
/api/services/errormessage:
get:
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.3.0</VersionPrefix>
<VersionSuffix>RC2</VersionSuffix>
<VersionSuffix>RC3</VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ await provisioningManager.UpdateCentralIdentityProviderDataOIDCAsync(
alias,
iamIdentityProvider => iamIdentityProvider.MetadataUrl = metadataUrl,
iamIdentityProvider => iamIdentityProvider.MetadataUrl = details.Oidc.MetadataUrl);
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}

private async ValueTask UpdateIdentityProviderSaml(string alias, IdentityProviderEditableDetails details)
Expand All @@ -323,6 +324,7 @@ await provisioningManager.UpdateCentralIdentityProviderDataSAMLAsync(
details.Saml.ServiceProviderEntityId,
details.Saml.SingleSignOnServiceUrl))
.ConfigureAwait(false);
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}

private async ValueTask UpdateIdentityProviderShared(string alias, IdentityProviderEditableDetails details)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.CorrelationId" Version="3.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/framework/Framework.Web/Framework.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.11" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Enrichers.CorrelationId" Version="3.0.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
</ItemGroup>

</Project>
52 changes: 12 additions & 40 deletions src/keycloak/Keycloak.Library/Components/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library;

public partial class KeycloakClient
{
public async Task CreateComponentAsync(string realm, Component componentRepresentation) =>
await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
public async Task CreateComponentAsync(string realm, Component componentRepresentation, CancellationToken cancellationToken) =>
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components")
.PostJsonAsync(componentRepresentation)
.PostJsonAsync(componentRepresentation, cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

public async Task<IEnumerable<Component>> GetComponentsAsync(string realm, string? name = null, string? parent = null, string? type = null)
public async Task<IEnumerable<Component>> GetComponentsAsync(string realm, string? name = null, string? parent = null, string? type = null, CancellationToken cancellationToken = default)
{
var queryParams = new Dictionary<string, object?>
{
Expand All @@ -47,58 +47,30 @@ public async Task<IEnumerable<Component>> GetComponentsAsync(string realm, strin
[nameof(type)] = type
};

return await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
return await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components")
.SetQueryParams(queryParams)
.GetJsonAsync<IEnumerable<Component>>()
.GetJsonAsync<IEnumerable<Component>>(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
}

public async Task<Component> GetComponentAsync(string realm, string componentId) =>
await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
public async Task UpdateComponentAsync(string realm, string componentId, Component componentRepresentation, CancellationToken cancellationToken) =>
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components/")
.AppendPathSegment(componentId, true)
.GetJsonAsync<Component>()
.PutJsonAsync(componentRepresentation, cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

public async Task UpdateComponentAsync(string realm, string componentId, Component componentRepresentation) =>
await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
public async Task DeleteComponentAsync(string realm, string componentId, CancellationToken cancellationToken) =>
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components/")
.AppendPathSegment(componentId, true)
.PutJsonAsync(componentRepresentation)
.DeleteAsync(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

public async Task DeleteComponentAsync(string realm, string componentId) =>
await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components/")
.AppendPathSegment(componentId, true)
.DeleteAsync()
.ConfigureAwait(ConfigureAwaitOptions.None);

public async Task<IEnumerable<ComponentType>> GetSubcomponentTypesAsync(string realm, string componentId, string? type = null)
{
var queryParams = new Dictionary<string, object?>
{
[nameof(type)] = type
};

var result = await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment("/admin/realms/")
.AppendPathSegment(realm, true)
.AppendPathSegment("/components/")
.AppendPathSegment(componentId, true)
.AppendPathSegment("/sub-component-types")
.SetQueryParams(queryParams)
.GetJsonAsync<IEnumerable<ComponentType>>()
.ConfigureAwait(ConfigureAwaitOptions.None);
return result;
}
}
1 change: 1 addition & 0 deletions src/keycloak/Keycloak.Library/Keycloak.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>ef300f2e-b1c3-4ce1-b028-92533b71aa73</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down
87 changes: 87 additions & 0 deletions src/keycloak/Keycloak.Library/Localization/KeycloakClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/********************************************************************************
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using Flurl.Http;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq;
using System.Net.Http.Headers;

namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library;

public partial class KeycloakClient
{
private const string AdminUrlSegment = "/admin/realms/";
private const string LocalizationUrlSegment = "/localization/";

public async Task<IEnumerable<string>> GetLocaleAsync(string realm, CancellationToken cancellationToken = default)
{
return await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment(AdminUrlSegment)
.AppendPathSegment(realm, true)
.AppendPathSegment("/localization")
.GetJsonAsync<IEnumerable<string>>(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
}

public async Task<IEnumerable<KeyValuePair<string, string>>> GetLocaleAsync(string realm, string locale, CancellationToken cancellationToken = default)
{
var response = await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment(AdminUrlSegment)
.AppendPathSegment(realm, true)
.AppendPathSegment(LocalizationUrlSegment)
.AppendPathSegment(locale, true)
.GetJsonAsync<IDictionary<string, string>?>(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

return response == null
? Enumerable.Empty<KeyValuePair<string, string>>()
: response.FilterNotNull();
}

public async Task UpdateLocaleAsync(string realm, string locale, string key, string translation, CancellationToken cancellationToken)
{
using var content = new StringContent(translation, MediaTypeHeaderValue.Parse("text/plain"));
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment(AdminUrlSegment)
.AppendPathSegment(realm, true)
.AppendPathSegment(LocalizationUrlSegment)
.AppendPathSegment(locale, true)
.AppendPathSegment(key, true)
.PutAsync(content, cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
}

public async Task DeleteLocaleAsync(string realm, string locale, string key, CancellationToken cancellationToken) =>
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment(AdminUrlSegment)
.AppendPathSegment(realm, true)
.AppendPathSegment(LocalizationUrlSegment)
.AppendPathSegment(locale, true)
.AppendPathSegment(key, true)
.DeleteAsync(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

public async Task DeleteLocaleAsync(string realm, string locale, CancellationToken cancellationToken) =>
await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None))
.AppendPathSegment(AdminUrlSegment)
.AppendPathSegment(realm, true)
.AppendPathSegment(LocalizationUrlSegment)
.AppendPathSegment(locale, true)
.DeleteAsync(cancellationToken: cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
}
20 changes: 13 additions & 7 deletions src/keycloak/Keycloak.Library/Models/Components/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Components
public class Component
{
[JsonPropertyName("id")]
public string Id { get; set; }
public string? Id { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }
public string? Name { get; set; }

[JsonPropertyName("providerId")]
public string ProviderId { get; set; }
public string? ProviderId { get; set; }

[JsonPropertyName("providerType")]
public string ProviderType { get; set; }
public string? ProviderType { get; set; }

[JsonPropertyName("parentId")]
public string ParentId { get; set; }
public string? ParentId { get; set; }

[JsonPropertyName("config")]
public Config Config { get; set; }
public IReadOnlyDictionary<string, IEnumerable<string>?>? Config { get; set; }

[JsonPropertyName("subType")]
public string SubType { get; set; }
public string? SubType { get; set; }
}
47 changes: 0 additions & 47 deletions src/keycloak/Keycloak.Library/Models/Components/Config.cs

This file was deleted.

4 changes: 4 additions & 0 deletions src/keycloak/Keycloak.Library/Models/RealmsAdmin/Realm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,8 @@ public class Realm
public bool? UserManagedAccessAllowed { get; set; }
[JsonPropertyName("passwordPolicy")]
public string? PasswordPolicy { get; set; }
[JsonPropertyName("defaultLocale")]
public string? DefaultLocale { get; set; }
[JsonPropertyName("localizationTexts")]
public IDictionary<string, IDictionary<string, string>?>? LocalizationTexts { get; set; }
}
5 changes: 4 additions & 1 deletion src/keycloak/Keycloak.Library/Models/Root/Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root;
public enum Locale
{
[EnumMember(Value = "en")]
En
En,

[EnumMember(Value = "de")]
De
}
Loading

0 comments on commit e96edaa

Please sign in to comment.