diff --git a/DEPENDENCIES b/DEPENDENCIES index d4cab7b11c..2bb74f779d 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,16 +1,15 @@ nuget/nuget/-/AutoFixture.AutoFakeItEasy/4.18.1, MIT, approved, #10064 nuget/nuget/-/AutoFixture.Xunit/4.18.1, MIT, approved, #10082 nuget/nuget/-/AutoFixture/4.18.1, MIT, approved, #10057 -nuget/nuget/-/BouncyCastle.Cryptography/2.2.1, MIT AND Apache-2.0 AND BSD-3-Clause AND LicenseRef-Permission-Notice, approved, #10066 nuget/nuget/-/BouncyCastle.Cryptography/2.4.0, MIT AND Apache-2.0 AND BSD-3-Clause AND LicenseRef-scancode-ietf-trust, approved, #15706 nuget/nuget/-/Castle.Core/5.1.1, Apache-2.0, approved, #13966 nuget/nuget/-/EFCore.NamingConventions/8.0.3, Apache-2.0, approved, #13983 nuget/nuget/-/FakeItEasy/8.3.0, MIT, approved, #16328 nuget/nuget/-/Fare/2.1.1, MIT, approved, clearlydefined nuget/nuget/-/FluentAssertions/6.12.1, MIT AND Apache-2.0 AND BSD-3-Clause AND CC-BY-3.0-US AND (GPL-2.0-only OR MIT) AND OFL-1.1 AND WTFPL, approved, #13976 -nuget/nuget/-/Flurl.Http.Signed/3.2.4, MIT, approved, #3503 -nuget/nuget/-/Flurl.Signed/3.0.6, MIT, approved, #3501 -nuget/nuget/-/HtmlAgilityPack/1.11.59, MIT, approved, #9293 +nuget/nuget/-/Flurl.Http.Signed/4.0.2, MIT, approved, #16447 +nuget/nuget/-/Flurl.Signed/4.0.0, MIT, approved, #16448 +nuget/nuget/-/HtmlAgilityPack/1.11.63, MIT, approved, #9293 nuget/nuget/-/Humanizer.Core/2.14.1, MIT, approved, #10060 nuget/nuget/-/Json.More.Net/2.0.0, MIT AND OFL-1.1 AND CC-BY-SA-4.0, approved, #15173 nuget/nuget/-/JsonPointer.Net/4.0.0, MIT, approved, clearlydefined @@ -21,8 +20,9 @@ nuget/nuget/-/MailKit/4.3.0, MIT AND LicenseRef-scancode-ietf AND LicenseRef-sca nuget/nuget/-/MimeKit/4.7.1, MIT AND FSFULLRWD AND LicenseRef-scancode-ietf AND LicenseRef-scancode-ietf-trust AND (BSD-3-Clause AND LicenseRef-scancode-ietf-trust) AND BSD-3-Clause AND MS-PL AND CC-BY-SA-4.0 AND LicenseRef-MIT-style AND CC-PDDC AND GPL-2.0-only, approved, #15705 nuget/nuget/-/Mono.TextTemplating/2.2.1, MIT, approved, #15073 nuget/nuget/-/NHamcrest/3.4.0, MIT, approved, #13964 -nuget/nuget/-/NJsonSchema/10.9.0, MIT, approved, #9300 -nuget/nuget/-/Namotion.Reflection/2.1.2, MIT, approved, #9320 +nuget/nuget/-/NJsonSchema.Annotations/11.0.2, MIT, approved, #15638 +nuget/nuget/-/NJsonSchema/11.0.2, MIT, approved, #15632 +nuget/nuget/-/Namotion.Reflection/3.1.1, MIT, approved, #15634 nuget/nuget/-/Newtonsoft.Json/13.0.1, MIT AND BSD-3-Clause, approved, #3266 nuget/nuget/-/Newtonsoft.Json/13.0.3, MIT AND BSD-3-Clause, approved, #3266 nuget/nuget/-/Npgsql.EntityFrameworkCore.PostgreSQL/8.0.4, PostgreSQL AND MIT, approved, #13972 @@ -31,7 +31,7 @@ nuget/nuget/-/PasswordGenerator/2.1.0, MIT, approved, #3192 nuget/nuget/-/ReportPortal.Client/3.4.0, Apache-2.0, approved, #9298 nuget/nuget/-/ReportPortal.Shared/3.6.0, Apache-2.0, approved, #10587 nuget/nuget/-/ReportPortal.XUnit/2.5.0, Apache-2.0, approved, #10588 -nuget/nuget/-/RestAssured.Net/4.2.1, Apache-2.0, approved, #13961 +nuget/nuget/-/RestAssured.Net/4.3.1, Apache-2.0, approved, #16238 nuget/nuget/-/SSH.NET/2023.0.0, MIT AND (MIT AND MS-PL) AND ISC, approved, #13965 nuget/nuget/-/Serilog.AspNetCore/8.0.1, Apache-2.0 AND MIT, approved, #13967 nuget/nuget/-/Serilog.Enrichers.CorrelationId/3.0.1, MIT, approved, clearlydefined @@ -56,9 +56,8 @@ nuget/nuget/-/Swashbuckle.AspNetCore.Swagger/6.8.0, MIT AND Apache-2.0, approved nuget/nuget/-/Swashbuckle.AspNetCore.SwaggerGen/6.8.0, MIT AND Apache-2.0, approved, #16259 nuget/nuget/-/Swashbuckle.AspNetCore.SwaggerUI/6.8.0, MIT AND Apache-2.0, approved, #16261 nuget/nuget/-/Swashbuckle.AspNetCore/6.8.0, MIT AND Apache-2.0, approved, #16260 -nuget/nuget/-/Testcontainers.PostgreSql/3.7.0, MIT, approved, #13960 +nuget/nuget/-/Testcontainers.PostgreSql/3.10.0, MIT, approved, #16241 nuget/nuget/-/Testcontainers/3.10.0, MIT, approved, #16236 -nuget/nuget/-/Testcontainers/3.7.0, MIT, approved, #13982 nuget/nuget/-/Xunit.Extensions.AssemblyFixture/2.4.1, MIT, approved, #3502 nuget/nuget/-/coverlet.collector/6.0.0, MIT, approved, #10075 nuget/nuget/-/coverlet.collector/6.0.2, MIT, approved, #10075 diff --git a/docs/api/administration-service.yaml b/docs/api/administration-service.yaml index f13ccdf7ba..280b677ece 100644 --- a/docs/api/administration-service.yaml +++ b/docs/api/administration-service.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Org.Eclipse.TractusX.Portal.Backend.Administration.Service - version: v2.3.0-alpha.1 + version: v2.3.0-alpha.2 paths: /api/administration/companydata/ownCompanyDetails: get: @@ -7788,6 +7788,7 @@ components: roleType: $ref: '#/components/schemas/UserRoleType' additionalProperties: false + description: Basic model for user role data needed to display user roles with description. UserRoleWithId: type: object properties: diff --git a/docs/api/apps-service.yaml b/docs/api/apps-service.yaml index 58800a0118..492cab72f8 100644 --- a/docs/api/apps-service.yaml +++ b/docs/api/apps-service.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Org.Eclipse.TractusX.Portal.Backend.Apps.Service - version: v2.3.0-alpha.1 + version: v2.3.0-alpha.2 paths: '/api/apps/AppChange/{appId}/role/activeapp': post: @@ -3762,7 +3762,14 @@ components: format: uuid roleName: type: string + type: + $ref: '#/components/schemas/UserRoleType' additionalProperties: false + UserRoleType: + enum: + - Internal + - External + type: string securitySchemes: Bearer: type: apiKey diff --git a/docs/api/notifications-service.yaml b/docs/api/notifications-service.yaml index f9c40168d2..009d7de7e3 100644 --- a/docs/api/notifications-service.yaml +++ b/docs/api/notifications-service.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Org.Eclipse.TractusX.Portal.Backend.Notifications.Service - version: v2.3.0-alpha.1 + version: v2.3.0-alpha.2 paths: /api/notification/errormessage: get: diff --git a/docs/api/registration-service.yaml b/docs/api/registration-service.yaml index c807004af5..c016075024 100644 --- a/docs/api/registration-service.yaml +++ b/docs/api/registration-service.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Org.Eclipse.TractusX.Portal.Backend.Registration.Service - version: v2.3.0-alpha.1 + version: v2.3.0-alpha.2 paths: /api/registration/errormessage: get: diff --git a/docs/api/services-service.yaml b/docs/api/services-service.yaml index 74f49491de..0a68496699 100644 --- a/docs/api/services-service.yaml +++ b/docs/api/services-service.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Org.Eclipse.TractusX.Portal.Backend.Services.Service - version: v2.3.0-alpha.1 + version: v2.3.0-alpha.2 paths: /api/services/errormessage: get: @@ -2824,7 +2824,14 @@ components: format: uuid roleName: type: string + type: + $ref: '#/components/schemas/UserRoleType' additionalProperties: false + UserRoleType: + enum: + - Internal + - External + type: string securitySchemes: Bearer: type: apiKey diff --git a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs index d71544ed11..bcb6704edc 100644 --- a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs @@ -33,10 +33,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities; using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; -using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; -using System.Collections.Immutable; -using System.Globalization; -using System.Text.Json; using System.Text.RegularExpressions; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; diff --git a/src/administration/Administration.Service/BusinessLogic/IServiceAccountManagement.cs b/src/administration/Administration.Service/BusinessLogic/IServiceAccountManagement.cs index 81cc828866..81c81a65fb 100644 --- a/src/administration/Administration.Service/BusinessLogic/IServiceAccountManagement.cs +++ b/src/administration/Administration.Service/BusinessLogic/IServiceAccountManagement.cs @@ -17,7 +17,6 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; diff --git a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs index 73ba7a336c..9a089bc0d9 100644 --- a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs @@ -23,7 +23,6 @@ using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Extensions; using Org.Eclipse.TractusX.Portal.Backend.Processes.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; diff --git a/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs b/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs index b1f018c1af..dffcaebe50 100644 --- a/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs +++ b/src/administration/Administration.Service/BusinessLogic/ServiceAccountManagement.cs @@ -18,7 +18,6 @@ ********************************************************************************/ using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; diff --git a/src/administration/Administration.Service/Controllers/ConnectorsController.cs b/src/administration/Administration.Service/Controllers/ConnectorsController.cs index ff8aa8a64a..f3324d2212 100644 --- a/src/administration/Administration.Service/Controllers/ConnectorsController.cs +++ b/src/administration/Administration.Service/Controllers/ConnectorsController.cs @@ -18,7 +18,6 @@ ********************************************************************************/ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Mvc; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; diff --git a/src/administration/Administration.Service/Controllers/ServiceAccountController.cs b/src/administration/Administration.Service/Controllers/ServiceAccountController.cs index 0cbc17a7f5..56f6131cb6 100644 --- a/src/administration/Administration.Service/Controllers/ServiceAccountController.cs +++ b/src/administration/Administration.Service/Controllers/ServiceAccountController.cs @@ -19,7 +19,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic; using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models; using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models; diff --git a/src/framework/Framework.Async/Directory.Build.props b/src/framework/Framework.Async/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Async/Directory.Build.props +++ b/src/framework/Framework.Async/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Cors/Directory.Build.props b/src/framework/Framework.Cors/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Cors/Directory.Build.props +++ b/src/framework/Framework.Cors/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.DBAccess/Directory.Build.props b/src/framework/Framework.DBAccess/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DBAccess/Directory.Build.props +++ b/src/framework/Framework.DBAccess/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.DateTimeProvider/Directory.Build.props b/src/framework/Framework.DateTimeProvider/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DateTimeProvider/Directory.Build.props +++ b/src/framework/Framework.DateTimeProvider/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.DependencyInjection/Directory.Build.props b/src/framework/Framework.DependencyInjection/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.DependencyInjection/Directory.Build.props +++ b/src/framework/Framework.DependencyInjection/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props b/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling.Controller/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling.Web/Directory.Build.props b/src/framework/Framework.ErrorHandling.Web/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling.Web/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling.Web/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.ErrorHandling/Directory.Build.props b/src/framework/Framework.ErrorHandling/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.ErrorHandling/Directory.Build.props +++ b/src/framework/Framework.ErrorHandling/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.HttpClientExtensions/Directory.Build.props b/src/framework/Framework.HttpClientExtensions/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.HttpClientExtensions/Directory.Build.props +++ b/src/framework/Framework.HttpClientExtensions/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.IO/Directory.Build.props b/src/framework/Framework.IO/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.IO/Directory.Build.props +++ b/src/framework/Framework.IO/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Linq/Directory.Build.props b/src/framework/Framework.Linq/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Linq/Directory.Build.props +++ b/src/framework/Framework.Linq/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Logging/Directory.Build.props b/src/framework/Framework.Logging/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Logging/Directory.Build.props +++ b/src/framework/Framework.Logging/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Models/Directory.Build.props b/src/framework/Framework.Models/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Models/Directory.Build.props +++ b/src/framework/Framework.Models/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Seeding/Directory.Build.props b/src/framework/Framework.Seeding/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Seeding/Directory.Build.props +++ b/src/framework/Framework.Seeding/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Seeding/Framework.Seeding.csproj b/src/framework/Framework.Seeding/Framework.Seeding.csproj index fbb13c93c1..a730a2f808 100644 --- a/src/framework/Framework.Seeding/Framework.Seeding.csproj +++ b/src/framework/Framework.Seeding/Framework.Seeding.csproj @@ -70,8 +70,6 @@ - - diff --git a/src/framework/Framework.Seeding/JsonHelper/SnakeCaseNamingPolicy.cs b/src/framework/Framework.Seeding/JsonHelper/SnakeCaseNamingPolicy.cs deleted file mode 100644 index b734f30a1f..0000000000 --- a/src/framework/Framework.Seeding/JsonHelper/SnakeCaseNamingPolicy.cs +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 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 Newtonsoft.Json.Serialization; -using System.Text.Json; - -namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding.JsonHelper; - -public class SnakeCaseNamingPolicy : JsonNamingPolicy -{ - private readonly SnakeCaseNamingStrategy _newtonsoftSnakeCaseNamingStrategy = new(); - - public static SnakeCaseNamingPolicy Instance { get; } = new(); - - public override string ConvertName(string name) - { - /* A conversion to snake case implementation goes here. */ - return _newtonsoftSnakeCaseNamingStrategy.GetPropertyName(name, false); - } -} diff --git a/src/framework/Framework.Seeding/SeederHelper.cs b/src/framework/Framework.Seeding/SeederHelper.cs index e6724ccdc8..375626f9af 100644 --- a/src/framework/Framework.Seeding/SeederHelper.cs +++ b/src/framework/Framework.Seeding/SeederHelper.cs @@ -20,7 +20,6 @@ using Microsoft.Extensions.Logging; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; -using Org.Eclipse.TractusX.Portal.Backend.Framework.Seeding.JsonHelper; using System.Collections.Concurrent; using System.Reflection; using System.Text.Json; @@ -31,7 +30,7 @@ public static class SeederHelper { private static readonly JsonSerializerOptions Options = new() { - PropertyNamingPolicy = new SnakeCaseNamingPolicy(), + PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, Converters = { new JsonDateTimeOffsetConverter() } }; diff --git a/src/framework/Framework.Swagger/Directory.Build.props b/src/framework/Framework.Swagger/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Swagger/Directory.Build.props +++ b/src/framework/Framework.Swagger/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Token/Directory.Build.props b/src/framework/Framework.Token/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Token/Directory.Build.props +++ b/src/framework/Framework.Token/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Web/Directory.Build.props b/src/framework/Framework.Web/Directory.Build.props index 59d8383e0c..cd99f1696a 100644 --- a/src/framework/Framework.Web/Directory.Build.props +++ b/src/framework/Framework.Web/Directory.Build.props @@ -19,7 +19,7 @@ - 2.10.0 + 2.11.0 diff --git a/src/framework/Framework.Web/Framework.Web.csproj b/src/framework/Framework.Web/Framework.Web.csproj index c62c975b23..6a718472ea 100644 --- a/src/framework/Framework.Web/Framework.Web.csproj +++ b/src/framework/Framework.Web/Framework.Web.csproj @@ -72,7 +72,6 @@ - diff --git a/src/framework/Framework.Web/WebApplicationBuildRunner.cs b/src/framework/Framework.Web/WebApplicationBuildRunner.cs index d14cc3b3c7..d8aea76b24 100644 --- a/src/framework/Framework.Web/WebApplicationBuildRunner.cs +++ b/src/framework/Framework.Web/WebApplicationBuildRunner.cs @@ -17,7 +17,6 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Flurl.Util; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; @@ -64,11 +63,8 @@ public static async Task BuildAndRunWebApplicationAsync( if (healthCheckPaths != null) { configuration - .Filter.ByExcluding(le => - { - return le.Properties.TryGetValue("RequestPath", out var logProperty) && - logProperty.ToKeyValuePairs().Any(x => healthCheckPaths.Contains(x.Value)); - }); + .Filter.ByExcluding(le => le.Properties.TryGetValue("RequestPath", out var logProperty) && + healthCheckPaths.Contains(logProperty.ToString())); } }); builder.Services diff --git a/src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs b/src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs index 1a9d7fb61a..e6e8cc9b87 100644 --- a/src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs +++ b/src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs @@ -30,7 +30,7 @@ public static class FlurlErrorHandler { public static void ConfigureErrorHandler(ILogger logger) { - FlurlHttp.Configure(settings => settings.OnError = (call) => + FlurlHttp.Clients.WithDefaults(c => c.OnError(call => { var message = $"{call.HttpResponseMessage?.ReasonPhrase ?? "ReasonPhrase is null"}: {call.HttpRequestMessage.RequestUri}"; @@ -38,23 +38,26 @@ public static void ConfigureErrorHandler(ILogger logger) { LogDebug(logger, call); } - if (call.HttpResponseMessage != null) + + if (call.HttpResponseMessage is null) + { + throw new ServiceException(message, call.Exception); + } + + var errorContent = JsonSerializer.Deserialize(call.HttpResponseMessage.Content.ReadAsStream())?.ErrorMessage; + if (!string.IsNullOrWhiteSpace(errorContent)) { - var errorContent = JsonSerializer.Deserialize(call.HttpResponseMessage.Content.ReadAsStream())?.ErrorMessage; - if (!string.IsNullOrWhiteSpace(errorContent)) - { - message = errorContent; - } - throw call.HttpResponseMessage.StatusCode switch - { - HttpStatusCode.NotFound => new KeycloakEntityNotFoundException(message, call.Exception), - HttpStatusCode.Conflict => new KeycloakEntityConflictException(message, call.Exception), - HttpStatusCode.BadRequest => new KeycloakNoSuccessException(message, call.Exception), - _ => new ServiceException(message, call.Exception, call.HttpResponseMessage.StatusCode), - }; + message = errorContent; } - throw new ServiceException(message, call.Exception); - }); + + throw call.HttpResponseMessage.StatusCode switch + { + HttpStatusCode.NotFound => new KeycloakEntityNotFoundException(message, call.Exception), + HttpStatusCode.Conflict => new KeycloakEntityConflictException(message, call.Exception), + HttpStatusCode.BadRequest => new KeycloakNoSuccessException(message, call.Exception), + _ => new ServiceException(message, call.Exception, call.HttpResponseMessage.StatusCode), + }; + })); } private static void LogDebug(ILogger logger, FlurlCall call) diff --git a/src/keycloak/Keycloak.ErrorHandling/FlurlUntrustedCertExceptionHandler.cs b/src/keycloak/Keycloak.ErrorHandling/FlurlUntrustedCertExceptionHandler.cs index 9fc534151f..85208b97b6 100644 --- a/src/keycloak/Keycloak.ErrorHandling/FlurlUntrustedCertExceptionHandler.cs +++ b/src/keycloak/Keycloak.ErrorHandling/FlurlUntrustedCertExceptionHandler.cs @@ -19,8 +19,6 @@ ********************************************************************************/ using Flurl.Http; -using Flurl.Http.Configuration; -using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling; @@ -30,25 +28,9 @@ public static void ConfigureExceptions(IEnumerable urlsToTrust) { foreach (var urlToTrust in urlsToTrust) { - FlurlHttp.ConfigureClient(urlToTrust, cli => cli.Settings.HttpClientFactory = new UntrustedCertHttpClientFactory()); + FlurlHttp + .ConfigureClientForUrl(urlToTrust) + .ConfigureInnerHandler(chc => chc.ServerCertificateCustomValidationCallback = (_, _, _, _) => true); } } } - -public class UntrustedCertHttpClientFactory : DefaultHttpClientFactory -{ - public override HttpMessageHandler CreateMessageHandler() - { - var handler = base.CreateMessageHandler(); - var httpClientHander = handler as HttpClientHandler; - if (httpClientHander != null) - { - httpClientHander.ServerCertificateCustomValidationCallback = (_, _, _, _) => true; - } - else - { - throw new ConfigurationException($"flurl HttpMessageHandler's type is not HttpClientHandler but {handler.GetType()}"); - } - return handler; - } -} diff --git a/src/keycloak/Keycloak.ErrorHandling/Keycloak.ErrorHandling.csproj b/src/keycloak/Keycloak.ErrorHandling/Keycloak.ErrorHandling.csproj index 9d33d37ad4..1b28547a9a 100644 --- a/src/keycloak/Keycloak.ErrorHandling/Keycloak.ErrorHandling.csproj +++ b/src/keycloak/Keycloak.ErrorHandling/Keycloak.ErrorHandling.csproj @@ -28,8 +28,7 @@ - - + diff --git a/src/keycloak/Keycloak.Factory/KeycloakFactory.cs b/src/keycloak/Keycloak.Factory/KeycloakFactory.cs index 85bf144767..836f291cfe 100644 --- a/src/keycloak/Keycloak.Factory/KeycloakFactory.cs +++ b/src/keycloak/Keycloak.Factory/KeycloakFactory.cs @@ -17,35 +17,16 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using Flurl.Http.Configuration; using Microsoft.Extensions.Options; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Factory; -public class KeycloakFactory : IKeycloakFactory +public class KeycloakFactory(IOptions options) + : IKeycloakFactory { - private readonly KeycloakSettingsMap _settings; - - private static readonly JsonSerializerSettings SerializerSettings = new() - { - NullValueHandling = NullValueHandling.Ignore, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - ProcessDictionaryKeys = false - } - } - }; - - public KeycloakFactory(IOptions settings) - { - _settings = settings.Value; - } + private readonly KeycloakSettingsMap _settings = options.Value; public KeycloakClient CreateKeycloakClient(string instance) { @@ -59,7 +40,6 @@ public KeycloakClient CreateKeycloakClient(string instance) var keycloakClient = settings.ClientSecret == null ? new KeycloakClient(settings.ConnectionString, settings.User, settings.Password, settings.AuthRealm, settings.UseAuthTrail) : KeycloakClient.CreateWithClientId(settings.ConnectionString, settings.ClientId, settings.ClientSecret, settings.UseAuthTrail, settings.AuthRealm); - keycloakClient.SetSerializer(new NewtonsoftJsonSerializer(SerializerSettings)); return keycloakClient; } @@ -73,7 +53,6 @@ public KeycloakClient CreateKeycloakClient(string instance, string clientId, str var settings = _settings.Single(x => x.Key.Equals(instance, StringComparison.InvariantCultureIgnoreCase)).Value; var keycloakClient = KeycloakClient.CreateWithClientId(settings.ConnectionString, clientId, secret, settings.UseAuthTrail, settings.AuthRealm); - keycloakClient.SetSerializer(new NewtonsoftJsonSerializer(SerializerSettings)); return keycloakClient; } diff --git a/src/keycloak/Keycloak.Library/AuthenticationManagement/KeycloakClient.cs b/src/keycloak/Keycloak.Library/AuthenticationManagement/KeycloakClient.cs index fb3117b11b..e9ccbdd766 100644 --- a/src/keycloak/Keycloak.Library/AuthenticationManagement/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/AuthenticationManagement/KeycloakClient.cs @@ -58,7 +58,7 @@ public async Task GetAuthenticatorConfigurationAsync(string .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/config/") .AppendPathSegment(configurationId, true) - .GetJsonAsync(cancellationToken) + .GetJsonAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateAuthenticatorConfigurationAsync(string realm, string configurationId, AuthenticatorConfig authenticatorConfig, CancellationToken cancellationToken = default) => @@ -67,7 +67,7 @@ public async Task UpdateAuthenticatorConfigurationAsync(string realm, string con .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/config/") .AppendPathSegment(configurationId, true) - .PutJsonAsync(authenticatorConfig, cancellationToken) + .PutJsonAsync(authenticatorConfig, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteAuthenticatorConfigurationAsync(string realm, string configurationId, CancellationToken cancellationToken = default) => @@ -76,7 +76,7 @@ public async Task DeleteAuthenticatorConfigurationAsync(string realm, string con .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/config/") .AppendPathSegment(configurationId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task AddAuthenticationExecutionAsync(string realm, AuthenticationExecution authenticationExecution) => @@ -102,7 +102,7 @@ public async Task DeleteAuthenticationExecutionAsync(string realm, string execut .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/executions/") .AppendPathSegment(executionId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task CreateAuthenticationExecutionConfigurationAsync(string realm, string executionId, AuthenticatorConfig authenticatorConfig, CancellationToken cancellationToken = default) => @@ -112,7 +112,7 @@ public async Task CreateAuthenticationExecutionConfigurationAsync(string realm, .AppendPathSegment("/authentication/executions/") .AppendPathSegment(executionId, true) .AppendPathSegment("/config") - .PostJsonAsync(authenticatorConfig, cancellationToken) + .PostJsonAsync(authenticatorConfig, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task LowerAuthenticationExecutionPriorityAsync(string realm, string executionId) @@ -146,7 +146,7 @@ public async Task CreateAuthenticationFlowAsync(string realm, AuthenticationFlow .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/flows") - .PostJsonAsync(authenticationFlow, cancellationToken) + .PostJsonAsync(authenticationFlow, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetAuthenticationFlowsAsync(string realm, CancellationToken cancellationToken = default) => @@ -154,7 +154,7 @@ public async Task> GetAuthenticationFlowsAsync(s .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/flows") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DuplicateAuthenticationFlowAsync(string realm, string flowAlias, string newName) => @@ -174,7 +174,7 @@ public async Task> GetAuthenticationFlo .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowAlias, true) .AppendPathSegment("/executions") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateAuthenticationFlowExecutionsAsync(string realm, string flowAlias, AuthenticationExecutionInfo authenticationExecutionInfo, CancellationToken cancellationToken = default) => @@ -184,7 +184,7 @@ public async Task UpdateAuthenticationFlowExecutionsAsync(string realm, string f .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowAlias, true) .AppendPathSegment("/executions") - .PutJsonAsync(authenticationExecutionInfo, cancellationToken) + .PutJsonAsync(authenticationExecutionInfo, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public Task AddAuthenticationFlowExecutionAsync(string realm, string flowAlias, IDictionary dataWithProvider, CancellationToken cancellationToken = default) => @@ -204,7 +204,7 @@ private async Task InternalAddAuthenticationFlowExecutionAsync(s .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowAlias, true) .AppendPathSegment("/executions/execution") - .PostJsonAsync(dataWithProvider, cancellationToken) + .PostJsonAsync(dataWithProvider, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public Task AddAuthenticationFlowAndExecutionToAuthenticationFlowAsync(string realm, string flowAlias, IDictionary dataWithAliasTypeProviderDescription, CancellationToken cancellationToken = default) => @@ -224,7 +224,7 @@ private async Task InternalAddAuthenticationFlowAndExecutionToAu .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowAlias, true) .AppendPathSegment("/executions/flow") - .PostJsonAsync(dataWithAliasTypeProviderDescription, cancellationToken) + .PostJsonAsync(dataWithAliasTypeProviderDescription, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task GetAuthenticationFlowByIdAsync(string realm, string flowId) => @@ -242,7 +242,7 @@ public async Task UpdateAuthenticationFlowAsync(string realm, string flowId, Aut .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowId, true) - .PutJsonAsync(authenticationFlow, cancellationToken) + .PutJsonAsync(authenticationFlow, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteAuthenticationFlowAsync(string realm, string flowId, CancellationToken cancellationToken = default) => @@ -251,7 +251,7 @@ public async Task DeleteAuthenticationFlowAsync(string realm, string flowId, Can .AppendPathSegment(realm, true) .AppendPathSegment("/authentication/flows/") .AppendPathSegment(flowId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task>> GetFormActionProvidersAsync(string realm) => diff --git a/src/keycloak/Keycloak.Library/ClientRoleMappings/KeycloakClient.cs b/src/keycloak/Keycloak.Library/ClientRoleMappings/KeycloakClient.cs index f35736e85f..0251296dcf 100644 --- a/src/keycloak/Keycloak.Library/ClientRoleMappings/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/ClientRoleMappings/KeycloakClient.cs @@ -95,7 +95,7 @@ public async Task AddClientRoleMappingsToUserAsync(string realm, string userId, .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/clients/") .AppendPathSegment(clientId, true) - .PostJsonAsync(roles, cancellationToken) + .PostJsonAsync(roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetClientRoleMappingsForUserAsync(string realm, string userId, string clientId, CancellationToken cancellationToken = default) => @@ -106,7 +106,7 @@ public async Task> GetClientRoleMappingsForUserAsync(string re .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/clients/") .AppendPathSegment(clientId, true) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteClientRoleMappingsFromUserAsync(string realm, string userId, string clientId, IEnumerable roles, CancellationToken cancellationToken = default) => @@ -117,7 +117,7 @@ public async Task DeleteClientRoleMappingsFromUserAsync(string realm, string use .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/clients/") .AppendPathSegment(clientId, true) - .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken) + .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetAvailableClientRoleMappingsForUserAsync(string realm, string userId, string clientId) => diff --git a/src/keycloak/Keycloak.Library/ClientScopes/KeycloakClient.cs b/src/keycloak/Keycloak.Library/ClientScopes/KeycloakClient.cs index e09ef422ab..5ec00d6537 100644 --- a/src/keycloak/Keycloak.Library/ClientScopes/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/ClientScopes/KeycloakClient.cs @@ -35,7 +35,7 @@ public async Task CreateClientScopeAsync(string realm, ClientScope clientScope, .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/client-scopes") - .PostJsonAsync(clientScope, cancellationToken) + .PostJsonAsync(clientScope, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetClientScopesAsync(string realm, CancellationToken cancellationToken = default) => @@ -43,7 +43,7 @@ public async Task> GetClientScopesAsync(string realm, C .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/client-scopes") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task GetClientScopeAsync(string realm, string clientScopeId) => @@ -61,7 +61,7 @@ public async Task UpdateClientScopeAsync(string realm, string clientScopeId, Cli .AppendPathSegment(realm, true) .AppendPathSegment("/client-scopes/") .AppendPathSegment(clientScopeId, true) - .PutJsonAsync(clientScope, cancellationToken) + .PutJsonAsync(clientScope, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteClientScopeAsync(string realm, string clientScopeId, CancellationToken cancellationToken = default) => @@ -70,6 +70,6 @@ public async Task DeleteClientScopeAsync(string realm, string clientScopeId, Can .AppendPathSegment(realm, true) .AppendPathSegment("/client-scopes/") .AppendPathSegment(clientScopeId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } diff --git a/src/keycloak/Keycloak.Library/Clients/KeycloakClient.cs b/src/keycloak/Keycloak.Library/Clients/KeycloakClient.cs index 6a7ea6a358..63f8ec3a5a 100644 --- a/src/keycloak/Keycloak.Library/Clients/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/Clients/KeycloakClient.cs @@ -51,7 +51,7 @@ private async Task InternalCreateClientAsync(string realm, Clien .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/clients") - .PostJsonAsync(client, cancellationToken) + .PostJsonAsync(client, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetClientsAsync(string realm, string? clientId = null, bool? viewableOnly = null, CancellationToken cancellationToken = default) @@ -67,7 +67,7 @@ public async Task> GetClientsAsync(string realm, string? cli .AppendPathSegment(realm, true) .AppendPathSegment("/clients") .SetQueryParams(queryParams) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } @@ -86,7 +86,7 @@ public async Task UpdateClientAsync(string realm, string clientId, Client client .AppendPathSegment(realm, true) .AppendPathSegment("/clients/") .AppendPathSegment(clientId, true) - .PutJsonAsync(client, cancellationToken) + .PutJsonAsync(client, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteClientAsync(string realm, string clientId) => @@ -129,7 +129,7 @@ public async Task> GetDefaultClientScopesAsync(string r .AppendPathSegment("/clients/") .AppendPathSegment(clientId, true) .AppendPathSegment("/default-client-scopes") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateDefaultClientScopeAsync(string realm, string clientId, string clientScopeId, CancellationToken cancellationToken = default) @@ -142,7 +142,7 @@ public async Task UpdateDefaultClientScopeAsync(string realm, string clientId, s .AppendPathSegment(clientId, true) .AppendPathSegment("/default-client-scopes/") .AppendPathSegment(clientScopeId, true) - .PutAsync(stringContent, cancellationToken) + .PutAsync(stringContent, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } public async Task DeleteDefaultClientScopeAsync(string realm, string clientId, string clientScopeId, CancellationToken cancellationToken = default) => @@ -153,7 +153,7 @@ public async Task DeleteDefaultClientScopeAsync(string realm, string clientId, s .AppendPathSegment(clientId, true) .AppendPathSegment("/default-client-scopes/") .AppendPathSegment(clientScopeId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); [Obsolete("Not working yet")] @@ -287,20 +287,6 @@ public async Task UnregisterClientClusterNodeAsync(string realm, string clientId .DeleteAsync() .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task GetClientOfflineSessionCountAsync(string realm, string clientId) - { - var result = await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/clients/") - .AppendPathSegment(clientId, true) - .AppendPathSegment("/offline-session-count") - .GetJsonAsync() - .ConfigureAwait(ConfigureAwaitOptions.None); - - return Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)); - } - public async Task> GetClientOfflineSessionsAsync(string realm, string clientId, int? first = null, int? max = null) { var queryParams = new Dictionary @@ -320,16 +306,6 @@ public async Task> GetClientOfflineSessionsAsync(string .ConfigureAwait(ConfigureAwaitOptions.None); } - public async Task> GetOptionalClientScopesAsync(string realm, string clientId, CancellationToken cancellationToken = default) => - await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/clients/") - .AppendPathSegment(clientId, true) - .AppendPathSegment("/optional-client-scopes") - .GetJsonAsync>(cancellationToken) - .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task UpdateOptionalClientScopeAsync(string realm, string clientId, string clientScopeId, CancellationToken cancellationToken = default) { using var stringContent = new StringContent(""); @@ -340,7 +316,7 @@ public async Task UpdateOptionalClientScopeAsync(string realm, string clientId, .AppendPathSegment(clientId, true) .AppendPathSegment("/optional-client-scopes/") .AppendPathSegment(clientScopeId, true) - .PutAsync(stringContent, cancellationToken) + .PutAsync(stringContent, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } @@ -352,7 +328,7 @@ public async Task DeleteOptionalClientScopeAsync(string realm, string clientId, .AppendPathSegment(clientId, true) .AppendPathSegment("/optional-client-scopes/") .AppendPathSegment(clientScopeId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task PushClientRevocationPolicyAsync(string realm, string clientId) @@ -394,20 +370,6 @@ public async Task GetUserForServiceAccountAsync(string realm, string clien .GetJsonAsync() .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task GetClientSessionCountAsync(string realm, string clientId) - { - var result = await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/clients/") - .AppendPathSegment(clientId, true) - .AppendPathSegment("/session-count") - .GetJsonAsync() - .ConfigureAwait(ConfigureAwaitOptions.None); - - return Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)); - } - public async Task TestClientClusterNodesAvailableAsync(string realm, string clientId) => await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") diff --git a/src/keycloak/Keycloak.Library/Common/Converters/AccessTokenCategoriesConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/AccessTokenCategoriesConverter.cs deleted file mode 100644 index 107279d49a..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/AccessTokenCategoriesConverter.cs +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class AccessTokenCategoriesConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [AccessTokenCategories.Internal] = "INTERNAL", - [AccessTokenCategories.Access] = "ACCESS", - [AccessTokenCategories.Id] = "ID", - [AccessTokenCategories.Admin] = "ADMIN", - [AccessTokenCategories.Userinfo] = "USERINFO" - }; - - protected override string EntityString { get; } = "access token category"; - - protected override string ConvertToString(AccessTokenCategories value) => s_pairs[value]; - - protected override AccessTokenCategories ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/AuthorizationPermissionTypeConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/AuthorizationPermissionTypeConverter.cs deleted file mode 100644 index 290a492b0f..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/AuthorizationPermissionTypeConverter.cs +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationPermissions; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class AuthorizationPermissionTypeConverter : JsonEnumConverter -{ - private static readonly Dictionary SPairs = new Dictionary - { - [AuthorizationPermissionType.Scope] = "scope", - [AuthorizationPermissionType.Resource] = "resource" - }; - - protected override string EntityString { get; } = "type"; - - protected override string ConvertToString(AuthorizationPermissionType value) => SPairs[value]; - - protected override AuthorizationPermissionType ConvertFromString(string s) - { - if (SPairs.ContainsValue(s.ToLower())) - { - return SPairs.First(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)).Key; - } - - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/CategoryConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/CategoryConverter.cs deleted file mode 100644 index 72ae61448d..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/CategoryConverter.cs +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class CategoryConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [Category.AttributeStatementMapper] = "attribute statement mapper", - [Category.DockerAuthMapper] = "docker auth mapper", - [Category.GroupMapper] = "group mapper", - [Category.RoleMapper] = "role mapper", - [Category.TokenMapper] = "token mapper" - }; - - protected override string EntityString { get; } = nameof(Category).ToLower(); - - protected override string ConvertToString(Category value) => s_pairs[value]; - - protected override Category ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/ConfigTypeConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/ConfigTypeConverter.cs deleted file mode 100644 index 5f56a1a2ed..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/ConfigTypeConverter.cs +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class ConfigTypeConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [ConfigType.Int] = "int", - [ConfigType.String] = "string" - }; - - protected override string EntityString { get; } = nameof(ConfigType).ToLower(); - - protected override string ConvertToString(ConfigType value) => s_pairs[value]; - - protected override ConfigType ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/DecisionStrategiesConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/DecisionStrategiesConverter.cs deleted file mode 100644 index 7884a7cf79..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/DecisionStrategiesConverter.cs +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationPermissions; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class DecisionStrategiesConverter : JsonEnumConverter -{ - private static readonly Dictionary SPairs = new Dictionary - { - [DecisionStrategy.Unanimous] = "UNANIMOUS", - [DecisionStrategy.Affirmative] = "AFFIRMATIVE", - [DecisionStrategy.Consensus] = "CONSENSUS" - }; - - protected override string EntityString { get; } = "decisionStrategy"; - - protected override string ConvertToString(DecisionStrategy value) => SPairs[value]; - - protected override DecisionStrategy ConvertFromString(string s) - { - if (SPairs.ContainsValue(s.ToUpper())) - { - return SPairs.First(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)).Key; - } - - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/GroupNameConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/GroupNameConverter.cs deleted file mode 100644 index 708aebe8c4..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/GroupNameConverter.cs +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class GroupNameConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [GroupName.Social] = "social", - [GroupName.UserDefined] = "userdefined" - }; - - protected override string EntityString { get; } = nameof(GroupName).ToLower(); - - protected override string ConvertToString(GroupName value) => s_pairs[value]; - - protected override GroupName ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/JsonEnumConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/JsonEnumConverter.cs deleted file mode 100644 index 84017120bc..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/JsonEnumConverter.cs +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public abstract class JsonEnumConverter : JsonConverter - where TEnum : struct, IConvertible -{ - protected abstract string EntityString { get; } - - protected abstract string ConvertToString(TEnum value); - - protected abstract TEnum ConvertFromString(string s); - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var actualValue = (TEnum)value; - writer.WriteValue(ConvertToString(actualValue)); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.StartArray) - { - var items = new List(); - var array = JArray.Load(reader); - items.AddRange(array.Select(x => ConvertFromString(x.ToString()))); - - return items; - } - - var s = (string)reader.Value; - return ConvertFromString(s); - } - - public override bool CanConvert(Type objectType) - { - return objectType == typeof(string); - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/JsonTypeLabelConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/JsonTypeLabelConverter.cs deleted file mode 100644 index 90c0c36b60..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/JsonTypeLabelConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class JsonTypeLabelConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [JsonTypeLabel.Boolean] = "boolean", - [JsonTypeLabel.ClientList] = "clientlist", - [JsonTypeLabel.File] = "file", - [JsonTypeLabel.List] = "list", - [JsonTypeLabel.MultivaluedList] = "multivaluedlist", - [JsonTypeLabel.MultivaluedString] = "multivaluedstring", - [JsonTypeLabel.Password] = "password", - [JsonTypeLabel.Role] = "role", - [JsonTypeLabel.Script] = "script", - [JsonTypeLabel.String] = "string", - [JsonTypeLabel.Text] = "text" - }; - - protected override string EntityString { get; } = nameof(JsonTypeLabel).ToLower(); - - protected override string ConvertToString(JsonTypeLabel value) => s_pairs[value]; - - protected override JsonTypeLabel ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/LocaleConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/LocaleConverter.cs deleted file mode 100644 index b5a5016db3..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/LocaleConverter.cs +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class LocaleConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [Locale.En] = "en" - }; - - protected override string EntityString { get; } = nameof(Locale).ToLower(); - - protected override string ConvertToString(Locale value) => s_pairs[value]; - - protected override Locale ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/NameConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/NameConverter.cs deleted file mode 100644 index 100b96256b..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/NameConverter.cs +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class NameConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [Name.Base] = "base", - [Name.Keycloak] = "keycloak", - [Name.RhSso] = "rh-sso" - }; - - protected override string EntityString { get; } = nameof(Name).ToLower(); - - protected override string ConvertToString(Name value) => s_pairs[value]; - - protected override Name ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/PoliciesConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/PoliciesConverter.cs deleted file mode 100644 index 7b672fa7bf..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/PoliciesConverter.cs +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class PoliciesConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [Policies.Skip] = "SKIP", - [Policies.Overwrite] = "OVERWRITE", - [Policies.Fail] = "FAIL" - }; - - protected override string EntityString { get; } = "policy"; - - protected override string ConvertToString(Policies value) => s_pairs[value]; - - protected override Policies ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/PolicyDecisionLogicConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/PolicyDecisionLogicConverter.cs deleted file mode 100644 index 17b6db4ac8..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/PolicyDecisionLogicConverter.cs +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationPermissions; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class PolicyDecisionLogicConverter : JsonEnumConverter -{ - private static readonly Dictionary SPairs = new Dictionary - { - [PolicyDecisionLogic.Positive] = "POSITIVE", - [PolicyDecisionLogic.Negative] = "NEGATIVE" - }; - - protected override string EntityString { get; } = "logic"; - - protected override string ConvertToString(PolicyDecisionLogic value) => SPairs[value]; - - protected override PolicyDecisionLogic ConvertFromString(string s) - { - if (SPairs.ContainsValue(s.ToUpper())) - { - return SPairs.First(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)).Key; - } - - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/PolicyTypeConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/PolicyTypeConverter.cs deleted file mode 100644 index 9f42a19e92..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/PolicyTypeConverter.cs +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class PolicyTypeConverter : JsonEnumConverter -{ - private static readonly Dictionary SPairs = new Dictionary - { - [PolicyType.Role] = "role", - [PolicyType.Client] = "client", - [PolicyType.Time] = "time", - [PolicyType.User] = "user", - [PolicyType.Aggregate] = "aggregate", - [PolicyType.Group] = "group", - [PolicyType.Js] = "js" - }; - - protected override string EntityString { get; } = "type"; - - protected override string ConvertToString(PolicyType value) => SPairs[value]; - - protected override PolicyType ConvertFromString(string s) - { - if (SPairs.ContainsValue(s.ToLower())) - { - return SPairs.First(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)).Key; - } - - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Converters/ProtocolConverter.cs b/src/keycloak/Keycloak.Library/Common/Converters/ProtocolConverter.cs deleted file mode 100644 index c4b1b4ae67..0000000000 --- a/src/keycloak/Keycloak.Library/Common/Converters/ProtocolConverter.cs +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * MIT License - * - * Copyright (c) 2019 Luk Vermeulen - * Copyright (c) 2022 Contributors to the Eclipse Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ********************************************************************************/ - -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; - -namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; - -public class ProtocolConverter : JsonEnumConverter -{ - private static readonly Dictionary s_pairs = new Dictionary - { - [Protocol.DockerV2] = "dockerv2", - [Protocol.OpenIdConnect] = "openid-connect", - [Protocol.Saml] = "Saml" - }; - - protected override string EntityString { get; } = nameof(Protocol).ToLower(); - - protected override string ConvertToString(Protocol value) => s_pairs[value]; - - protected override Protocol ConvertFromString(string s) - { - var pair = s_pairs.FirstOrDefault(kvp => kvp.Value.Equals(s, StringComparison.OrdinalIgnoreCase)); - // ReSharper disable once SuspiciousTypeConversion.Global - if (EqualityComparer>.Default.Equals(pair)) - { - throw new ArgumentException($"Unknown {EntityString}: {s}"); - } - - return pair.Key; - } -} diff --git a/src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs b/src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs index fdb4ab6ada..de67e3c0dd 100644 --- a/src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs +++ b/src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs @@ -25,6 +25,7 @@ using Flurl; using Flurl.Http; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions; @@ -43,13 +44,10 @@ private static async Task GetAccessTokenAsync(string url, string realm, new KeyValuePair("password", password), new KeyValuePair("client_id", "admin-cli") }, - cancellationToken) - .ReceiveJson().ConfigureAwait(ConfigureAwaitOptions.None); + cancellationToken: cancellationToken) + .ReceiveJson().ConfigureAwait(ConfigureAwaitOptions.None); - string accessToken = result - .access_token.ToString(); - - return accessToken; + return result.AccessToken; } private static async Task GetAccessTokenWithClientIdAsync(string url, string realm, string clientSecret, string? clientId, bool useAuthTrail, CancellationToken cancellationToken) @@ -64,13 +62,10 @@ private static async Task GetAccessTokenWithClientIdAsync(string url, st new("client_secret", clientSecret), new("client_id", clientId ?? "admin-cli") }, - cancellationToken) - .ReceiveJson().ConfigureAwait(ConfigureAwaitOptions.None); - - string accessToken = result - .access_token.ToString(); + cancellationToken: cancellationToken) + .ReceiveJson().ConfigureAwait(ConfigureAwaitOptions.None); - return accessToken; + return result.AccessToken; } public static async Task WithAuthenticationAsync(this IFlurlRequest request, Func>? getTokenAsync, string url, string realm, string? userName, string? password, string? clientSecret, string? clientId, bool useAuthTrail, CancellationToken cancellationToken) @@ -115,4 +110,8 @@ public static IFlurlRequest WithForwardedHttpHeaders(this IFlurlRequest request, return request; } + + public record AccessTokenResponse( + [property: JsonPropertyName("access_token")] string AccessToken + ); } diff --git a/src/keycloak/Keycloak.Library/Groups/KeycloakClient.cs b/src/keycloak/Keycloak.Library/Groups/KeycloakClient.cs index ed34f62a41..666e90cf62 100644 --- a/src/keycloak/Keycloak.Library/Groups/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/Groups/KeycloakClient.cs @@ -60,25 +60,6 @@ public async Task> GetGroupHierarchyAsync(string realm, int? .ConfigureAwait(ConfigureAwaitOptions.None); } - public async Task GetGroupsCountAsync(string realm, string? search = null, bool? top = null) - { - var queryParams = new Dictionary - { - [nameof(search)] = search, - [nameof(top)] = top - }; - - var result = await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/groups/count") - .SetQueryParams(queryParams) - .GetJsonAsync() - .ConfigureAwait(ConfigureAwaitOptions.None); - - return Convert.ToInt32(DynamicExtensions.GetFirstPropertyValue(result)); - } - public async Task GetGroupAsync(string realm, string groupId) => await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") diff --git a/src/keycloak/Keycloak.Library/IdentityProviders/KeycloakClient.cs b/src/keycloak/Keycloak.Library/IdentityProviders/KeycloakClient.cs index 0e5057def6..ddbf39e1cd 100644 --- a/src/keycloak/Keycloak.Library/IdentityProviders/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/IdentityProviders/KeycloakClient.cs @@ -49,7 +49,7 @@ public async Task> ImportIdentityProviderFromUrlAsyn { ["fromUrl"] = url, ["providerId"] = "oidc" - }, cancellationToken) + }, cancellationToken: cancellationToken) .ReceiveJson>() .ConfigureAwait(ConfigureAwaitOptions.None); @@ -58,7 +58,7 @@ public async Task CreateIdentityProviderAsync(string realm, IdentityProvider ide .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/identity-provider/instances") - .PostJsonAsync(identityProvider, cancellationToken) + .PostJsonAsync(identityProvider, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetIdentityProviderInstancesAsync(string realm) => @@ -75,7 +75,7 @@ public async Task GetIdentityProviderAsync(string realm, strin .AppendPathSegment(realm, true) .AppendPathSegment("/identity-provider/instances/") .AppendPathSegment(identityProviderAlias, true) - .GetJsonAsync(cancellationToken) + .GetJsonAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); /// @@ -100,7 +100,7 @@ public async Task UpdateIdentityProviderAsync(string realm, string identityProvi .AppendPathSegment(realm, true) .AppendPathSegment("/identity-provider/instances/") .AppendPathSegment(identityProviderAlias, true) - .PutJsonAsync(identityProvider, cancellationToken) + .PutJsonAsync(identityProvider, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteIdentityProviderAsync(string realm, string identityProviderAlias) => @@ -160,7 +160,7 @@ public async Task AddIdentityProviderMapperAsync(string realm, string identityPr .AppendPathSegment("/identity-provider/instances/") .AppendPathSegment(identityProviderAlias, true) .AppendPathSegment("/mappers") - .PostJsonAsync(identityProviderMapper, cancellationToken) + .PostJsonAsync(identityProviderMapper, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetIdentityProviderMappersAsync(string realm, string identityProviderAlias, CancellationToken cancellationToken = default) => @@ -170,7 +170,7 @@ public async Task> GetIdentityProviderMapper .AppendPathSegment("/identity-provider/instances/") .AppendPathSegment(identityProviderAlias, true) .AppendPathSegment("/mappers") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task GetIdentityProviderMapperByIdAsync(string realm, string identityProviderAlias, string mapperId) => @@ -192,7 +192,7 @@ public async Task UpdateIdentityProviderMapperAsync(string realm, string identit .AppendPathSegment(identityProviderAlias, true) .AppendPathSegment("/mappers/") .AppendPathSegment(mapperId, true) - .PutJsonAsync(identityProviderMapper, cancellationToken) + .PutJsonAsync(identityProviderMapper, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteIdentityProviderMapperAsync(string realm, string identityProviderAlias, string mapperId, CancellationToken cancellationToken = default) => @@ -203,7 +203,7 @@ public async Task DeleteIdentityProviderMapperAsync(string realm, string identit .AppendPathSegment(identityProviderAlias, true) .AppendPathSegment("/mappers/") .AppendPathSegment(mapperId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task GetIdentityProviderByProviderIdAsync(string realm, string providerId) => diff --git a/src/keycloak/Keycloak.Library/Keycloak.Library.csproj b/src/keycloak/Keycloak.Library/Keycloak.Library.csproj index dd4113d5d7..b0e7f5a261 100644 --- a/src/keycloak/Keycloak.Library/Keycloak.Library.csproj +++ b/src/keycloak/Keycloak.Library/Keycloak.Library.csproj @@ -27,15 +27,15 @@ Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library + Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library net8.0 enable enable - + - @@ -43,4 +43,8 @@ + + + + diff --git a/src/keycloak/Keycloak.Library/KeycloakClient.cs b/src/keycloak/Keycloak.Library/KeycloakClient.cs index 30a9eed8cb..cbdb5fadc5 100644 --- a/src/keycloak/Keycloak.Library/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/KeycloakClient.cs @@ -26,19 +26,19 @@ using Flurl; using Flurl.Http; using Flurl.Http.Configuration; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library; public partial class KeycloakClient { - private ISerializer _serializer = new NewtonsoftJsonSerializer(new JsonSerializerSettings + private readonly JsonSerializerOptions _jsonOptions = new() { - ContractResolver = new CamelCasePropertyNamesContractResolver(), - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore - }); + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + }; private readonly Url _url; private readonly string? _userName; @@ -77,7 +77,7 @@ private KeycloakClient(string url, string? userName, string? password, string? a public KeycloakClient(string url, Func getToken, string? authRealm = null) : this(url) { - _getTokenAsync = (_) => Task.FromResult(getToken()); + _getTokenAsync = _ => Task.FromResult(getToken()); _authRealm = authRealm; } @@ -93,11 +93,6 @@ public static KeycloakClient CreateWithClientId(string url, string? clientId, st return new KeycloakClient(url, userName: null, password: null, authRealm, clientId, clientSecret, useAuthTrail); } - public void SetSerializer(ISerializer serializer) - { - _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); - } - private Task GetBaseUrlAsync(string targetRealm, CancellationToken cancellationToken = default) { var url = new Url(_url); @@ -108,7 +103,7 @@ private Task GetBaseUrlAsync(string targetRealm, CancellationToke } return url - .ConfigureRequest(settings => settings.JsonSerializer = _serializer) + .WithSettings(s => s.JsonSerializer = new DefaultJsonSerializer(_jsonOptions)) .WithAuthenticationAsync(_getTokenAsync, _url, _authRealm ?? targetRealm, _userName, _password, _clientSecret, _clientId, _useAuthTrail, cancellationToken); } } diff --git a/src/keycloak/Keycloak.Library/Models/AttackDetection/UserNameStatus.cs b/src/keycloak/Keycloak.Library/Models/AttackDetection/UserNameStatus.cs index 1d8c2f0f53..2c7c88d97b 100644 --- a/src/keycloak/Keycloak.Library/Models/AttackDetection/UserNameStatus.cs +++ b/src/keycloak/Keycloak.Library/Models/AttackDetection/UserNameStatus.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AttackDetection; public class UserNameStatus { - [JsonProperty("numFailures")] + [JsonPropertyName("numFailures")] public int? NumFailures { get; set; } - [JsonProperty("disabled")] + [JsonPropertyName("disabled")] public bool? Disabled { get; set; } - [JsonProperty("lastIPFailure")] + [JsonPropertyName("lastIPFailure")] public string LastIpFailure { get; set; } - [JsonProperty("lastFailure")] + [JsonPropertyName("lastFailure")] public int? LastFailure { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecution.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecution.cs index f4d33522b2..367347ffc9 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecution.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecution.cs @@ -23,16 +23,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationExecution : AuthenticationExecutionBase { - [JsonProperty("flowId")] + [JsonPropertyName("flowId")] public string FlowId { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("parentFlow")] + [JsonPropertyName("parentFlow")] public string ParentFlow { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionBase.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionBase.cs index a9623c7688..59615f8f6a 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionBase.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionBase.cs @@ -23,22 +23,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public abstract class AuthenticationExecutionBase { - [JsonProperty("authenticator")] + [JsonPropertyName("authenticator")] public string? Authenticator { get; set; } - [JsonProperty("authenticatorConfig")] + [JsonPropertyName("authenticatorConfig")] public string? AuthenticatorConfig { get; set; } - [JsonProperty("authenticatorFlow")] + [JsonPropertyName("authenticatorFlow")] public bool? AuthenticatorFlow { get; set; } - [JsonProperty("autheticatorFlow")] + [JsonPropertyName("autheticatorFlow")] public bool? AutheticatorFlow { get; set; } - [JsonProperty("priority")] + [JsonPropertyName("priority")] public int? Priority { get; set; } - [JsonProperty("requirement")] + [JsonPropertyName("requirement")] public string? Requirement { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionById.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionById.cs index 705d690aea..a1ddc50ad7 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionById.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionById.cs @@ -23,32 +23,32 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationExecutionById { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("authenticator")] + [JsonPropertyName("authenticator")] public string? Authenticator { get; set; } - [JsonProperty("authenticatorFlow")] + [JsonPropertyName("authenticatorFlow")] public bool? AuthenticatorFlow { get; set; } - [JsonProperty("requirement")] + [JsonPropertyName("requirement")] public string? Requirement { get; set; } - [JsonProperty("priority")] + [JsonPropertyName("priority")] public int? Priority { get; set; } - [JsonProperty("parentFlow")] + [JsonPropertyName("parentFlow")] public string? ParentFlow { get; set; } - [JsonProperty("optional")] + [JsonPropertyName("optional")] public bool? Optional { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("required")] + [JsonPropertyName("required")] public bool? Required { get; set; } - [JsonProperty("alternative")] + [JsonPropertyName("alternative")] public bool? Alternative { get; set; } - [JsonProperty("disabled")] + [JsonPropertyName("disabled")] public bool? Disabled { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionExport.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionExport.cs index e0ec283a2f..8e61bc3956 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionExport.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionExport.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationExecutionExport : AuthenticationExecutionBase { - [JsonProperty("flowAlias")] + [JsonPropertyName("flowAlias")] public string? FlowAlias { get; set; } - [JsonProperty("userSetupAllowed")] + [JsonPropertyName("userSetupAllowed")] public bool? UserSetupAllowed { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionInfo.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionInfo.cs index 94eece70b3..3c11d27cce 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationExecutionInfo.cs @@ -24,36 +24,36 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationExecutionInfo { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string? Alias { get; set; } - [JsonProperty("authenticationConfig")] + [JsonPropertyName("authenticationConfig")] public string? AuthenticationConfig { get; set; } - [JsonProperty("authenticationFlow")] + [JsonPropertyName("authenticationFlow")] public bool? AuthenticationFlow { get; set; } - [JsonProperty("configurable")] + [JsonPropertyName("configurable")] public bool? Configurable { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string? DisplayName { get; set; } - [JsonProperty("flowId")] + [JsonPropertyName("flowId")] public string? FlowId { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("index")] + [JsonPropertyName("index")] public int? Index { get; set; } - [JsonProperty("level")] + [JsonPropertyName("level")] public int? Level { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string? ProviderId { get; set; } - [JsonProperty("requirement")] + [JsonPropertyName("requirement")] public string? Requirement { get; set; } - [JsonProperty("requirementChoices")] + [JsonPropertyName("requirementChoices")] public IEnumerable? RequirementChoices { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlow.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlow.cs index 00ba344f6f..11bb098d36 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlow.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlow.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationFlow { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string? Alias { get; set; } - [JsonProperty("authenticationExecutions")] + [JsonPropertyName("authenticationExecutions")] public IEnumerable? AuthenticationExecutions { get; set; } - [JsonProperty("builtIn")] + [JsonPropertyName("builtIn")] public bool? BuiltIn { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string? ProviderId { get; set; } - [JsonProperty("topLevel")] + [JsonPropertyName("topLevel")] public bool? TopLevel { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlowExecution.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlowExecution.cs index b4f91ee527..e157f334a8 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlowExecution.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticationFlowExecution.cs @@ -24,34 +24,34 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticationFlowExecution { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("requirement")] + [JsonPropertyName("requirement")] public string? Requirement { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string? DisplayName { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("requirementChoices")] + [JsonPropertyName("requirementChoices")] public IEnumerable? RequirementChoices { get; set; } - [JsonProperty("configurable")] + [JsonPropertyName("configurable")] public bool? Configurable { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string? ProviderId { get; set; } - [JsonProperty("level")] + [JsonPropertyName("level")] public int? Level { get; set; } - [JsonProperty("index")] + [JsonPropertyName("index")] public int? Index { get; set; } - [JsonProperty("authenticationFlow")] + [JsonPropertyName("authenticationFlow")] public bool? AuthenticationFlow { get; set; } - [JsonProperty("flowId")] + [JsonPropertyName("flowId")] public string? FlowId { get; set; } - [JsonProperty("authenticationConfig")] + [JsonPropertyName("authenticationConfig")] public string? AuthenticationConfig { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfig.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfig.cs index 6304500788..f9903fe36d 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfig.cs @@ -24,16 +24,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticatorConfig { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string? Alias { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public IDictionary? Config { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfigInfo.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfigInfo.cs index 30aaf49004..132642a527 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfigInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/AuthenticatorConfigInfo.cs @@ -24,19 +24,19 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class AuthenticatorConfigInfo { - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public IEnumerable Properties { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string ProviderId { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/RequiredActionProvider.cs b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/RequiredActionProvider.cs index ab091f3ef4..2bbea12eee 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/RequiredActionProvider.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthenticationManagement/RequiredActionProvider.cs @@ -23,24 +23,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthenticationManagement; public class RequiredActionProvider { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string Alias { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public IDictionary Config { get; set; } - [JsonProperty("defaultAction")] + [JsonPropertyName("defaultAction")] public bool? DefaultAction { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("priority")] + [JsonPropertyName("priority")] public int? Priority { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string ProviderId { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthorizationPermissions/AuthorizationPermission.cs b/src/keycloak/Keycloak.Library/Models/AuthorizationPermissions/AuthorizationPermission.cs index e4cc05afc6..7ba109cb15 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthorizationPermissions/AuthorizationPermission.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthorizationPermissions/AuthorizationPermission.cs @@ -23,59 +23,71 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationPermissions; public class AuthorizationPermission { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string Description { get; set; } - [JsonConverter(typeof(AuthorizationPermissionTypeConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public AuthorizationPermissionType Type { get; set; } - [JsonConverter(typeof(PolicyDecisionLogicConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public PolicyDecisionLogic Logic { get; set; } - [JsonConverter(typeof(DecisionStrategiesConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public DecisionStrategy DecisionStrategy { get; set; } - [JsonProperty("resourceType")] + [JsonPropertyName("resourceType")] public string ResourceType { get; set; } - [JsonProperty("resources")] + [JsonPropertyName("resources")] public IEnumerable ResourceIds { get; set; } - [JsonProperty("scopes")] + [JsonPropertyName("scopes")] public IEnumerable ScopeIds { get; set; } - [JsonProperty("policies")] + [JsonPropertyName("policies")] public IEnumerable PolicyIds { get; set; } } public enum PolicyDecisionLogic { + [EnumMember(Value = "POSITIVE")] Positive, + + [EnumMember(Value = "NEGATIVE")] Negative } public enum AuthorizationPermissionType { + [EnumMember(Value = "scope")] Scope, + + [EnumMember(Value = "resource")] Resource } public enum DecisionStrategy { + [EnumMember(Value = "UNANIMOUS")] Unanimous, + + [EnumMember(Value = "AFFIRMATIVE")] Affirmative, + + [EnumMember(Value = "CONSENSUS")] Consensus } diff --git a/src/keycloak/Keycloak.Library/Models/AuthorizationResources/AuthorizationResource.cs b/src/keycloak/Keycloak.Library/Models/AuthorizationResources/AuthorizationResource.cs index b6103bee72..8b575d0450 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthorizationResources/AuthorizationResource.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthorizationResources/AuthorizationResource.cs @@ -24,27 +24,27 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationScopes; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationResources; public class AuthorizationResource { - [JsonProperty("_id")] + [JsonPropertyName("_id")] public string Id { get; set; } - [JsonProperty("scopes")] + [JsonPropertyName("scopes")] public IEnumerable Scopes { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public Dictionary> Attributes { get; set; } - [JsonProperty("uris")] + [JsonPropertyName("uris")] public IEnumerable Uris { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("ownerManagedAccess")] + [JsonPropertyName("ownerManagedAccess")] public bool? OwnerManagedAccess { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string DisplayName { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/AuthorizationScopes/AuthorizationScope.cs b/src/keycloak/Keycloak.Library/Models/AuthorizationScopes/AuthorizationScope.cs index 0d527ee2c2..58c91a4178 100644 --- a/src/keycloak/Keycloak.Library/Models/AuthorizationScopes/AuthorizationScope.cs +++ b/src/keycloak/Keycloak.Library/Models/AuthorizationScopes/AuthorizationScope.cs @@ -23,14 +23,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationScopes; public class AuthorizationScope { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/Certificate.cs b/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/Certificate.cs index 2ecc6a1891..50aab61b02 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/Certificate.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/Certificate.cs @@ -24,19 +24,19 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientAttributeCertificate; public class Certificate { - [JsonProperty("certificate")] + [JsonPropertyName("certificate")] // ReSharper disable once InconsistentNaming public string _Certificate { get; set; } - [JsonProperty("kid")] + [JsonPropertyName("kid")] public string Kid { get; set; } - [JsonProperty("privateKey")] + [JsonPropertyName("privateKey")] public string PrivateKey { get; set; } - [JsonProperty("publicKey")] + [JsonPropertyName("publicKey")] public string PublicKey { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/KeyStoreConfig.cs b/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/KeyStoreConfig.cs index e96f58af31..1c7b60a626 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/KeyStoreConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientAttributeCertificate/KeyStoreConfig.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientAttributeCertificate; public class KeyStoreConfig { - [JsonProperty("format")] + [JsonPropertyName("format")] public string Format { get; set; } - [JsonProperty("keyAlias")] + [JsonPropertyName("keyAlias")] public string KeyAlias { get; set; } - [JsonProperty("keyPassword")] + [JsonPropertyName("keyPassword")] public string KeyPassword { get; set; } - [JsonProperty("realmAlias")] + [JsonPropertyName("realmAlias")] public string RealmAlias { get; set; } - [JsonProperty("realmCertificate")] + [JsonPropertyName("realmCertificate")] public string RealmCertificate { get; set; } - [JsonProperty("storePassword")] + [JsonPropertyName("storePassword")] public string StorePassword { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessCreatePresentation.cs b/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessCreatePresentation.cs index f646471d87..5cb2059066 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessCreatePresentation.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessCreatePresentation.cs @@ -23,14 +23,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientInitialAccess; public class ClientInitialAccessCreatePresentation { - [JsonProperty("count")] + [JsonPropertyName("count")] public int? Count { get; set; } - [JsonProperty("expiration")] + [JsonPropertyName("expiration")] public int? Expiration { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessPresentation.cs b/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessPresentation.cs index d55e805246..89302ea381 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessPresentation.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientInitialAccess/ClientInitialAccessPresentation.cs @@ -23,18 +23,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientInitialAccess; public class ClientInitialAccessPresentation : ClientInitialAccessCreatePresentation { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("remainingCount")] + [JsonPropertyName("remainingCount")] public int? RemainingCount { get; set; } - [JsonProperty("timestamp")] + [JsonPropertyName("timestamp")] public int? Timestamp { get; set; } - [JsonProperty("token")] + [JsonPropertyName("token")] public string Token { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientScopes/Attributes.cs b/src/keycloak/Keycloak.Library/Models/ClientScopes/Attributes.cs index 088db7b916..7b244e9327 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientScopes/Attributes.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientScopes/Attributes.cs @@ -24,16 +24,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientScopes; public class Attributes { - [JsonProperty("consent.screen.text")] + [JsonPropertyName("consent.screen.text")] public string? ConsentScreenText { get; set; } - [JsonProperty("display.on.consent.screen")] + [JsonPropertyName("display.on.consent.screen")] public string? DisplayOnConsentScreen { get; set; } - [JsonProperty("include.in.token.scope")] + [JsonPropertyName("include.in.token.scope")] public string? IncludeInTokenScope { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ClientScopes/ClientScope.cs b/src/keycloak/Keycloak.Library/Models/ClientScopes/ClientScope.cs index bde6b58632..0049f34d4b 100644 --- a/src/keycloak/Keycloak.Library/Models/ClientScopes/ClientScope.cs +++ b/src/keycloak/Keycloak.Library/Models/ClientScopes/ClientScope.cs @@ -24,23 +24,23 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ProtocolMappers; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ClientScopes; public class ClientScope { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public string? Protocol { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public Attributes? Attributes { get; set; } - [JsonProperty("protocolMappers")] + [JsonPropertyName("protocolMappers")] public IEnumerable? ProtocolMappers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AccessToken.cs b/src/keycloak/Keycloak.Library/Models/Clients/AccessToken.cs index d4a1f5e3ca..4863b4726a 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AccessToken.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AccessToken.cs @@ -24,96 +24,96 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class AccessToken { - [JsonProperty("acr")] + [JsonPropertyName("acr")] public string Acr { get; set; } - [JsonProperty("address")] + [JsonPropertyName("address")] public AddressClaimSet Address { get; set; } - [JsonProperty("allowed-origins")] + [JsonPropertyName("allowed-origins")] public IEnumerable AllowedOrigins { get; set; } - [JsonProperty("at_hash")] + [JsonPropertyName("at_hash")] public string AtHash { get; set; } - [JsonProperty("auth_time")] + [JsonPropertyName("auth_time")] public int? AuthTime { get; set; } - [JsonProperty("authorization")] + [JsonPropertyName("authorization")] public AccessTokenAuthorization Authorization { get; set; } - [JsonProperty("azp")] + [JsonPropertyName("azp")] public string Azp { get; set; } - [JsonProperty("birthdate")] + [JsonPropertyName("birthdate")] public string Birthdate { get; set; } - [JsonProperty("c_hash")] + [JsonPropertyName("c_hash")] public string CHash { get; set; } - [JsonProperty("category")] - [JsonConverter(typeof(AccessTokenCategoriesConverter))] + [JsonPropertyName("category")] + [JsonConverter(typeof(EnumMemberConverter))] public AccessTokenCategories Category { get; set; } - [JsonProperty("claims_locales")] + [JsonPropertyName("claims_locales")] public string ClaimsLocales { get; set; } - [JsonProperty("cnf")] + [JsonPropertyName("cnf")] public AccessTokenCertConf Cnf { get; set; } - [JsonProperty("email")] + [JsonPropertyName("email")] public string Email { get; set; } - [JsonProperty("email_verified")] + [JsonPropertyName("email_verified")] public bool? EmailVerified { get; set; } - [JsonProperty("exp")] + [JsonPropertyName("exp")] public int? Exp { get; set; } - [JsonProperty("family_name")] + [JsonPropertyName("family_name")] public string FamilyName { get; set; } - [JsonProperty("gender")] + [JsonPropertyName("gender")] public string Gender { get; set; } - [JsonProperty("given_name")] + [JsonPropertyName("given_name")] public string GivenName { get; set; } - [JsonProperty("iat")] + [JsonPropertyName("iat")] public int? Iat { get; set; } - [JsonProperty("iss")] + [JsonPropertyName("iss")] public string Iss { get; set; } - [JsonProperty("jti")] + [JsonPropertyName("jti")] public string Jti { get; set; } - [JsonProperty("locale")] + [JsonPropertyName("locale")] public string Locale { get; set; } - [JsonProperty("middle_name")] + [JsonPropertyName("middle_name")] public string MiddleName { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("nickname")] + [JsonPropertyName("nickname")] public string Nickname { get; set; } - [JsonProperty("nonce")] + [JsonPropertyName("nonce")] public string Nonce { get; set; } - [JsonProperty("otherClaims")] + [JsonPropertyName("otherClaims")] public IDictionary OtherClaims { get; set; } - [JsonProperty("phone_number")] + [JsonPropertyName("phone_number")] public string PhoneNumber { get; set; } - [JsonProperty("phone_number_verified")] + [JsonPropertyName("phone_number_verified")] public bool? PhoneNumberVerified { get; set; } - [JsonProperty("picture")] + [JsonPropertyName("picture")] public string Picture { get; set; } - [JsonProperty("preferred_username")] + [JsonPropertyName("preferred_username")] public string PreferredUsername { get; set; } - [JsonProperty("profile")] + [JsonPropertyName("profile")] public string Profile { get; set; } - [JsonProperty("realm_access")] + [JsonPropertyName("realm_access")] public AccessTokenAccess RealmAccess { get; set; } - [JsonProperty("s_hash")] + [JsonPropertyName("s_hash")] public string Hash { get; set; } - [JsonProperty("scope")] + [JsonPropertyName("scope")] public string Scope { get; set; } - [JsonProperty("session_state")] + [JsonPropertyName("session_state")] public string SessionState { get; set; } - [JsonProperty("sub")] + [JsonPropertyName("sub")] public string Sub { get; set; } - [JsonProperty("trusted-certs")] + [JsonPropertyName("trusted-certs")] public IEnumerable TrustedCerts { get; set; } - [JsonProperty("typ")] + [JsonPropertyName("typ")] public string Typ { get; set; } - [JsonProperty("updated_at")] + [JsonPropertyName("updated_at")] public long UpdatedAt { get; set; } - [JsonProperty("website")] + [JsonPropertyName("website")] public string Website { get; set; } - [JsonProperty("zoneinfo")] + [JsonPropertyName("zoneinfo")] public string Zoneinfo { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAccess.cs b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAccess.cs index ce0b8637c1..3300035e88 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAccess.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAccess.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class AccessTokenAccess { - [JsonProperty("roles")] + [JsonPropertyName("roles")] public IEnumerable Roles { get; set; } - [JsonProperty("verify_caller")] + [JsonPropertyName("verify_caller")] public bool? VerifyCaller { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAuthorization.cs b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAuthorization.cs index 37f1f762ec..3a05f26419 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAuthorization.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenAuthorization.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class AccessTokenAuthorization { - [JsonProperty("permissions")] + [JsonPropertyName("permissions")] public IEnumerable Permissions { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCategories.cs b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCategories.cs index 54b85e03ff..be62a15cea 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCategories.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCategories.cs @@ -24,13 +24,24 @@ * SOFTWARE. ********************************************************************************/ +using System.Runtime.Serialization; + namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public enum AccessTokenCategories { + [EnumMember(Value = "INTERNAL")] Internal, + + [EnumMember(Value = "ACCESS")] Access, + + [EnumMember(Value = "ID")] Id, + + [EnumMember(Value = "ADMIN")] Admin, + + [EnumMember(Value = "USERINFO")] Userinfo } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCertConf.cs b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCertConf.cs index ac50e74435..3bb01c7dcf 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCertConf.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AccessTokenCertConf.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class AccessTokenCertConf { - [JsonProperty("x5t#S256")] + [JsonPropertyName("x5t#S256")] public string X5Ts256 { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/AddressClaimSet.cs b/src/keycloak/Keycloak.Library/Models/Clients/AddressClaimSet.cs index 96db72a1ae..46bc5e7464 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/AddressClaimSet.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/AddressClaimSet.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class AddressClaimSet { - [JsonProperty("country")] + [JsonPropertyName("country")] public string Country { get; set; } - [JsonProperty("formatted")] + [JsonPropertyName("formatted")] public string Formatted { get; set; } - [JsonProperty("locality")] + [JsonPropertyName("locality")] public string Locality { get; set; } - [JsonProperty("postal_code")] + [JsonPropertyName("postal_code")] public string PostalCode { get; set; } - [JsonProperty("region")] + [JsonPropertyName("region")] public string Region { get; set; } - [JsonProperty("street_address")] + [JsonPropertyName("street_address")] public string StreetAddress { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/Client.cs b/src/keycloak/Keycloak.Library/Models/Clients/Client.cs index fa6be5e3a2..d6521f03ed 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/Client.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/Client.cs @@ -23,76 +23,77 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ProtocolMappers; +using System.Text.Json.Serialization; + namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class Client { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string? ClientId { get; set; } - [JsonProperty("rootUrl")] + [JsonPropertyName("rootUrl")] public string? RootUrl { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("baseUrl")] + [JsonPropertyName("baseUrl")] public string? BaseUrl { get; set; } - [JsonProperty("surrogateAuthRequired")] + [JsonPropertyName("surrogateAuthRequired")] public bool? SurrogateAuthRequired { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("alwaysDisplayInConsole")] + [JsonPropertyName("alwaysDisplayInConsole")] public bool? AlwaysDisplayInConsole { get; set; } - [JsonProperty("clientAuthenticatorType")] + [JsonPropertyName("clientAuthenticatorType")] public string? ClientAuthenticatorType { get; set; } - [JsonProperty("redirectUris")] + [JsonPropertyName("redirectUris")] public IEnumerable? RedirectUris { get; set; } - [JsonProperty("webOrigins")] + [JsonPropertyName("webOrigins")] public IEnumerable? WebOrigins { get; set; } - [JsonProperty("notBefore")] + [JsonPropertyName("notBefore")] public int? NotBefore { get; set; } - [JsonProperty("bearerOnly")] + [JsonPropertyName("bearerOnly")] public bool? BearerOnly { get; set; } - [JsonProperty("consentRequired")] + [JsonPropertyName("consentRequired")] public bool? ConsentRequired { get; set; } - [JsonProperty("standardFlowEnabled")] + [JsonPropertyName("standardFlowEnabled")] public bool? StandardFlowEnabled { get; set; } - [JsonProperty("implicitFlowEnabled")] + [JsonPropertyName("implicitFlowEnabled")] public bool? ImplicitFlowEnabled { get; set; } - [JsonProperty("directAccessGrantsEnabled")] + [JsonPropertyName("directAccessGrantsEnabled")] public bool? DirectAccessGrantsEnabled { get; set; } - [JsonProperty("serviceAccountsEnabled")] + [JsonPropertyName("serviceAccountsEnabled")] public bool? ServiceAccountsEnabled { get; set; } - [JsonProperty("publicClient")] + [JsonPropertyName("publicClient")] public bool? PublicClient { get; set; } - [JsonProperty("frontchannelLogout")] + [JsonPropertyName("frontchannelLogout")] public bool? FrontChannelLogout { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public string? Protocol { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public IDictionary? Attributes { get; set; } - [JsonProperty("authenticationFlowBindingOverrides")] + [JsonPropertyName("authenticationFlowBindingOverrides")] public IDictionary? AuthenticationFlowBindingOverrides { get; set; } - [JsonProperty("fullScopeAllowed")] + [JsonPropertyName("fullScopeAllowed")] public bool? FullScopeAllowed { get; set; } - [JsonProperty("nodeReRegistrationTimeout")] + [JsonPropertyName("nodeReRegistrationTimeout")] public int? NodeReregistrationTimeout { get; set; } - [JsonProperty("protocolMappers")] + [JsonPropertyName("protocolMappers")] public IEnumerable? ProtocolMappers { get; set; } - [JsonProperty("defaultClientScopes")] + [JsonPropertyName("defaultClientScopes")] public IEnumerable? DefaultClientScopes { get; set; } - [JsonProperty("optionalClientScopes")] + [JsonPropertyName("optionalClientScopes")] public IEnumerable? OptionalClientScopes { get; set; } - [JsonProperty("access")] + [JsonPropertyName("access")] public ClientAccess? Access { get; set; } - [JsonProperty("secret")] + [JsonPropertyName("secret")] public string? Secret { get; set; } - [JsonProperty("authorizationServicesEnabled")] + [JsonPropertyName("authorizationServicesEnabled")] public bool? AuthorizationServicesEnabled { get; set; } - [JsonProperty("adminUrl")] + [JsonPropertyName("adminUrl")] public string? AdminUrl { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/ClientAccess.cs b/src/keycloak/Keycloak.Library/Models/Clients/ClientAccess.cs index 9c12ba3c43..2febd65526 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/ClientAccess.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/ClientAccess.cs @@ -24,16 +24,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class ClientAccess { - [JsonProperty("view")] + [JsonPropertyName("view")] public bool? View { get; set; } - [JsonProperty("configure")] + [JsonPropertyName("configure")] public bool? Configure { get; set; } - [JsonProperty("manage")] + [JsonPropertyName("manage")] public bool? Manage { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/ClientConfig.cs b/src/keycloak/Keycloak.Library/Models/Clients/ClientConfig.cs index ee507f2d2b..e32560ef9b 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/ClientConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/ClientConfig.cs @@ -24,29 +24,29 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class ClientConfig { - [JsonProperty("userinfo.token.claim")] + [JsonPropertyName("userinfo.token.claim")] public string? UserInfoTokenClaim { get; set; } - [JsonProperty("user.attribute")] + [JsonPropertyName("user.attribute")] public string? UserAttribute { get; set; } - [JsonProperty("id.token.claim")] + [JsonPropertyName("id.token.claim")] public string? IdTokenClaim { get; set; } - [JsonProperty("access.token.claim")] + [JsonPropertyName("access.token.claim")] public string? AccessTokenClaim { get; set; } - [JsonProperty("claim.name")] + [JsonPropertyName("claim.name")] public string? ClaimName { get; set; } - [JsonProperty("jsonType.label")] + [JsonPropertyName("jsonType.label")] public string? JsonTypelabel { get; set; } - [JsonProperty("friendly.name")] + [JsonPropertyName("friendly.name")] public string? FriendlyName { get; set; } - [JsonProperty("attribute.name")] + [JsonPropertyName("attribute.name")] public string? AttributeName { get; set; } - [JsonProperty("user.session.note")] + [JsonPropertyName("user.session.note")] public string? UserSessionNote { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/ClientProtocolMapper.cs b/src/keycloak/Keycloak.Library/Models/Clients/ClientProtocolMapper.cs index 828c40c4f2..65c38dbc99 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/ClientProtocolMapper.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/ClientProtocolMapper.cs @@ -24,23 +24,23 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ProtocolMappers; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class ClientProtocolMapper { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public string? Protocol { get; set; } - [JsonProperty("protocolMapper")] + [JsonPropertyName("protocolMapper")] public string? ProtocolMapper { get; set; } - [JsonProperty("consentRequired")] + [JsonPropertyName("consentRequired")] public bool? ConsentRequired { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public Config? Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/ClientScopeEvaluateResourceProtocolMapperEvaluation.cs b/src/keycloak/Keycloak.Library/Models/Clients/ClientScopeEvaluateResourceProtocolMapperEvaluation.cs index d633fc0ec6..89d0bbcb4c 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/ClientScopeEvaluateResourceProtocolMapperEvaluation.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/ClientScopeEvaluateResourceProtocolMapperEvaluation.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class ClientScopeEvaluateResourceProtocolMapperEvaluation { - [JsonProperty("containerId")] + [JsonPropertyName("containerId")] public string ContainerId { get; set; } - [JsonProperty("containerName")] + [JsonPropertyName("containerName")] public string ContainerName { get; set; } - [JsonProperty("containerType")] + [JsonPropertyName("containerType")] public string ContainerType { get; set; } - [JsonProperty("mapperId")] + [JsonPropertyName("mapperId")] public string MapperId { get; set; } - [JsonProperty("mapperName")] + [JsonPropertyName("mapperName")] public string MapperName { get; set; } - [JsonProperty("protocolMapper")] + [JsonPropertyName("protocolMapper")] public string ProtocolMapper { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/Permission.cs b/src/keycloak/Keycloak.Library/Models/Clients/Permission.cs index c5f480b517..659596c83b 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/Permission.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/Permission.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class Permission : Resource { - [JsonProperty("claims")] + [JsonPropertyName("claims")] public IDictionary Claims { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/Resource.cs b/src/keycloak/Keycloak.Library/Models/Clients/Resource.cs index 0304ecaf93..1f3043a8f8 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/Resource.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/Resource.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class Resource { - [JsonProperty("rsid")] + [JsonPropertyName("rsid")] public string RsId { get; set; } - [JsonProperty("rsname")] + [JsonPropertyName("rsname")] public string RsName { get; set; } - [JsonProperty("scopes")] + [JsonPropertyName("scopes")] public IEnumerable Scopes { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Clients/RolePolicy.cs b/src/keycloak/Keycloak.Library/Models/Clients/RolePolicy.cs index fc6c87ec0c..a51d61d3ee 100644 --- a/src/keycloak/Keycloak.Library/Models/Clients/RolePolicy.cs +++ b/src/keycloak/Keycloak.Library/Models/Clients/RolePolicy.cs @@ -24,82 +24,96 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.AuthorizationPermissions; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; public class Policy { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string Description { get; set; } - [JsonConverter(typeof(PolicyTypeConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public PolicyType Type { get; set; } - [JsonConverter(typeof(PolicyDecisionLogicConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public PolicyDecisionLogic Logic { get; set; } - [JsonConverter(typeof(DecisionStrategiesConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public DecisionStrategy DecisionStrategy { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public PolicyConfig Config { get; set; } } public class RolePolicy { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string Description { get; set; } - [JsonConverter(typeof(PolicyTypeConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public PolicyType Type { get; set; } = PolicyType.Role; - [JsonConverter(typeof(PolicyDecisionLogicConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public PolicyDecisionLogic Logic { get; set; } - [JsonConverter(typeof(DecisionStrategiesConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public DecisionStrategy DecisionStrategy { get; set; } - [JsonProperty("roles")] + [JsonPropertyName("roles")] public IEnumerable RoleConfigs { get; set; } } public class RoleConfig { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("required")] + [JsonPropertyName("required")] public bool Required { get; set; } } public enum PolicyType { + [EnumMember(Value = "role")] Role, + + [EnumMember(Value = "client")] Client, + + [EnumMember(Value = "time")] Time, + + [EnumMember(Value = "user")] User, + + [EnumMember(Value = "aggregate")] Aggregate, + + [EnumMember(Value = "group")] Group, + + [EnumMember(Value = "js")] Js } public class PolicyConfig { - [JsonProperty("roles")] + [JsonPropertyName("roles")] public IEnumerable RoleConfigs { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Common/ClientRoleMapping.cs b/src/keycloak/Keycloak.Library/Models/Common/ClientRoleMapping.cs index a42d28c278..2a9a669de4 100644 --- a/src/keycloak/Keycloak.Library/Models/Common/ClientRoleMapping.cs +++ b/src/keycloak/Keycloak.Library/Models/Common/ClientRoleMapping.cs @@ -24,17 +24,17 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; public class ClientRoleMapping { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("client")] + [JsonPropertyName("client")] public string Client { get; set; } - [JsonProperty("mappings")] + [JsonPropertyName("mappings")] public List Mappings { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Common/ConfigProperty.cs b/src/keycloak/Keycloak.Library/Models/Common/ConfigProperty.cs index af9ffb5424..20df4a1500 100644 --- a/src/keycloak/Keycloak.Library/Models/Common/ConfigProperty.cs +++ b/src/keycloak/Keycloak.Library/Models/Common/ConfigProperty.cs @@ -24,31 +24,31 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; public class ConfigProperty { - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("label")] + [JsonPropertyName("label")] public string Label { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public JsonTypeLabel Type { get; set; } - [JsonProperty("secret")] + [JsonPropertyName("secret")] public bool? Secret { get; set; } - [JsonProperty("defaultValue")] + [JsonPropertyName("defaultValue")] public string DefaultValue { get; set; } - [JsonProperty("options")] + [JsonPropertyName("options")] public List Options { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Common/GlobalRequestResult.cs b/src/keycloak/Keycloak.Library/Models/Common/GlobalRequestResult.cs index f7d483eea9..391643a64d 100644 --- a/src/keycloak/Keycloak.Library/Models/Common/GlobalRequestResult.cs +++ b/src/keycloak/Keycloak.Library/Models/Common/GlobalRequestResult.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; public class GlobalRequestResult { - [JsonProperty("failedRequests")] + [JsonPropertyName("failedRequests")] public IEnumerable FailedRequests { get; set; } - [JsonProperty("successRequests")] + [JsonPropertyName("successRequests")] public IEnumerable SuccessRequests { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Common/ManagementPermission.cs b/src/keycloak/Keycloak.Library/Models/Common/ManagementPermission.cs index 6eb84946d2..bcf965f4f0 100644 --- a/src/keycloak/Keycloak.Library/Models/Common/ManagementPermission.cs +++ b/src/keycloak/Keycloak.Library/Models/Common/ManagementPermission.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; public class ManagementPermission { - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Common/Mapping.cs b/src/keycloak/Keycloak.Library/Models/Common/Mapping.cs index 7c55d5b319..82e1c7402a 100644 --- a/src/keycloak/Keycloak.Library/Models/Common/Mapping.cs +++ b/src/keycloak/Keycloak.Library/Models/Common/Mapping.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; public class Mapping { - [JsonProperty("clientMappings")] + [JsonPropertyName("clientMappings")] public IDictionary ClientMappings { get; set; } - [JsonProperty("realmMappings")] + [JsonPropertyName("realmMappings")] public IEnumerable RealmMappings { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Components/Component.cs b/src/keycloak/Keycloak.Library/Models/Components/Component.cs index 91afef15d4..301767263a 100644 --- a/src/keycloak/Keycloak.Library/Models/Components/Component.cs +++ b/src/keycloak/Keycloak.Library/Models/Components/Component.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Components; public class Component { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string ProviderId { get; set; } - [JsonProperty("providerType")] + [JsonPropertyName("providerType")] public string ProviderType { get; set; } - [JsonProperty("parentId")] + [JsonPropertyName("parentId")] public string ParentId { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public Config Config { get; set; } - [JsonProperty("subType")] + [JsonPropertyName("subType")] public string SubType { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Components/ComponentType.cs b/src/keycloak/Keycloak.Library/Models/Components/ComponentType.cs index a8514a7fd5..3dca5eebf0 100644 --- a/src/keycloak/Keycloak.Library/Models/Components/ComponentType.cs +++ b/src/keycloak/Keycloak.Library/Models/Components/ComponentType.cs @@ -24,19 +24,19 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Components; public class ComponentType { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public IEnumerable Properties { get; set; } - [JsonProperty("metadata")] + [JsonPropertyName("metadata")] public IDictionary Metadata { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Components/Config.cs b/src/keycloak/Keycloak.Library/Models/Components/Config.cs index 2746e642aa..3497e32b34 100644 --- a/src/keycloak/Keycloak.Library/Models/Components/Config.cs +++ b/src/keycloak/Keycloak.Library/Models/Components/Config.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Components; public class Config { - [JsonProperty("priority")] + [JsonPropertyName("priority")] public IEnumerable Priority { get; set; } - [JsonProperty("allowdefaultscopes")] + [JsonPropertyName("allowdefaultscopes")] public IEnumerable AllowDefaultScopes { get; set; } - [JsonProperty("maxclients")] + [JsonPropertyName("maxclients")] public IEnumerable MaxClients { get; set; } - [JsonProperty("allowedprotocolmappertypes")] + [JsonPropertyName("allowedprotocolmappertypes")] public IEnumerable AllowedProtocolMapperTypes { get; set; } - [JsonProperty("algorithm")] + [JsonPropertyName("algorithm")] public IEnumerable Algorithm { get; set; } - [JsonProperty("hostsendingregistrationrequestmustmatch")] + [JsonPropertyName("hostsendingregistrationrequestmustmatch")] public IEnumerable HostSendingRegistrationRequestMustMatch { get; set; } - [JsonProperty("clienturismustmatch")] + [JsonPropertyName("clienturismustmatch")] public IEnumerable ClientUrisMustMatch { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Groups/Group.cs b/src/keycloak/Keycloak.Library/Models/Groups/Group.cs index 9ee436c7a0..341bce8bd4 100644 --- a/src/keycloak/Keycloak.Library/Models/Groups/Group.cs +++ b/src/keycloak/Keycloak.Library/Models/Groups/Group.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Groups; public class Group { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("path")] + [JsonPropertyName("path")] public string Path { get; set; } - [JsonProperty("subGroups")] + [JsonPropertyName("subGroups")] public IEnumerable Subgroups { get; set; } - [JsonProperty("realmRoles")] + [JsonPropertyName("realmRoles")] public IEnumerable RealmRoles { get; set; } - [JsonProperty("clientRoles")] + [JsonPropertyName("clientRoles")] public IDictionary> ClientRoles { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public IDictionary> Attributes { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/IdentityProviders/Config.cs b/src/keycloak/Keycloak.Library/Models/IdentityProviders/Config.cs index 9ecefb5a29..df0783b2c4 100644 --- a/src/keycloak/Keycloak.Library/Models/IdentityProviders/Config.cs +++ b/src/keycloak/Keycloak.Library/Models/IdentityProviders/Config.cs @@ -24,82 +24,82 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; public class Config { - [JsonProperty("hideOnLoginPage")] + [JsonPropertyName("hideOnLoginPage")] public string? HideOnLoginPage { get; set; } - [JsonProperty("clientSecret")] + [JsonPropertyName("clientSecret")] public string? ClientSecret { get; set; } - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string? ClientId { get; set; } - [JsonProperty("disableUserInfo")] + [JsonPropertyName("disableUserInfo")] public string? DisableUserInfo { get; set; } - [JsonProperty("useJwksUrl")] + [JsonPropertyName("useJwksUrl")] public string? UseJwksUrl { get; set; } - [JsonProperty("tokenUrl")] + [JsonPropertyName("tokenUrl")] public string? TokenUrl { get; set; } - [JsonProperty("authorizationUrl")] + [JsonPropertyName("authorizationUrl")] public string? AuthorizationUrl { get; set; } - [JsonProperty("logoutUrl")] + [JsonPropertyName("logoutUrl")] public string? LogoutUrl { get; set; } - [JsonProperty("jwksUrl")] + [JsonPropertyName("jwksUrl")] public string? JwksUrl { get; set; } - [JsonProperty("clientAuthMethod")] + [JsonPropertyName("clientAuthMethod")] public string? ClientAuthMethod { get; set; } - [JsonProperty("clientAssertionSigningAlg")] + [JsonPropertyName("clientAssertionSigningAlg")] public string? ClientAssertionSigningAlg { get; set; } - [JsonProperty("syncMode")] + [JsonPropertyName("syncMode")] public string? SyncMode { get; set; } - [JsonProperty("validateSignature")] + [JsonPropertyName("validateSignature")] public string? ValidateSignature { get; set; } - [JsonProperty("userInfoUrl")] + [JsonPropertyName("userInfoUrl")] public string? UserInfoUrl { get; set; } - [JsonProperty("issuer")] + [JsonPropertyName("issuer")] public string? Issuer { get; set; } // for SAML: - [JsonProperty("nameIDPolicyFormat")] + [JsonPropertyName("nameIDPolicyFormat")] public string? NameIDPolicyFormat { get; set; } - [JsonProperty("principalType")] + [JsonPropertyName("principalType")] public string? PrincipalType { get; set; } - [JsonProperty("signatureAlgorithm")] + [JsonPropertyName("signatureAlgorithm")] public string? SignatureAlgorithm { get; set; } - [JsonProperty("xmlSigKeyInfoKeyNameTransformer")] + [JsonPropertyName("xmlSigKeyInfoKeyNameTransformer")] public string? XmlSigKeyInfoKeyNameTransformer { get; set; } - [JsonProperty("allowCreate")] + [JsonPropertyName("allowCreate")] public string? AllowCreate { get; set; } - [JsonProperty("entityId")] + [JsonPropertyName("entityId")] public string? EntityId { get; set; } - [JsonProperty("authnContextComparisonType")] + [JsonPropertyName("authnContextComparisonType")] public string? AuthnContextComparisonType { get; set; } - [JsonProperty("backchannelSupported")] + [JsonPropertyName("backchannelSupported")] public string? BackchannelSupported { get; set; } - [JsonProperty("postBindingResponse")] + [JsonPropertyName("postBindingResponse")] public string? PostBindingResponse { get; set; } - [JsonProperty("postBindingAuthnRequest")] + [JsonPropertyName("postBindingAuthnRequest")] public string? PostBindingAuthnRequest { get; set; } - [JsonProperty("postBindingLogout")] + [JsonPropertyName("postBindingLogout")] public string? PostBindingLogout { get; set; } - [JsonProperty("wantAuthnRequestsSigned")] + [JsonPropertyName("wantAuthnRequestsSigned")] public string? WantAuthnRequestsSigned { get; set; } - [JsonProperty("wantAssertionsSigned")] + [JsonPropertyName("wantAssertionsSigned")] public string? WantAssertionsSigned { get; set; } - [JsonProperty("wantAssertionsEncrypted")] + [JsonPropertyName("wantAssertionsEncrypted")] public string? WantAssertionsEncrypted { get; set; } - [JsonProperty("forceAuthn")] + [JsonPropertyName("forceAuthn")] public string? ForceAuthn { get; set; } - [JsonProperty("signSpMetadata")] + [JsonPropertyName("signSpMetadata")] public string? SignSpMetadata { get; set; } - [JsonProperty("loginHint")] + [JsonPropertyName("loginHint")] public string? LoginHint { get; set; } - [JsonProperty("singleSignOnServiceUrl")] + [JsonPropertyName("singleSignOnServiceUrl")] public string? SingleSignOnServiceUrl { get; set; } - [JsonProperty("allowedClockSkew")] + [JsonPropertyName("allowedClockSkew")] public string? AllowedClockSkew { get; set; } - [JsonProperty("attributeConsumingServiceIndex")] + [JsonPropertyName("attributeConsumingServiceIndex")] public string? AttributeConsumingServiceIndex { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProvider.cs b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProvider.cs index bfd6a7fb6e..e4484d57c2 100644 --- a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProvider.cs +++ b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProvider.cs @@ -24,38 +24,38 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; public class IdentityProvider { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string? Alias { get; set; } - [JsonProperty("internalId")] + [JsonPropertyName("internalId")] public string? InternalId { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string? ProviderId { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("updateProfileFirstLoginMode")] + [JsonPropertyName("updateProfileFirstLoginMode")] public string? UpdateProfileFirstLoginMode { get; set; } - [JsonProperty("trustEmail")] + [JsonPropertyName("trustEmail")] public bool? TrustEmail { get; set; } - [JsonProperty("storeToken")] + [JsonPropertyName("storeToken")] public bool? StoreToken { get; set; } - [JsonProperty("addReadTokenRoleOnCreate")] + [JsonPropertyName("addReadTokenRoleOnCreate")] public bool? AddReadTokenRoleOnCreate { get; set; } - [JsonProperty("authenticateByDefault")] + [JsonPropertyName("authenticateByDefault")] public bool? AuthenticateByDefault { get; set; } - [JsonProperty("linkOnly")] + [JsonPropertyName("linkOnly")] public bool? LinkOnly { get; set; } - [JsonProperty("firstBrokerLoginFlowAlias")] + [JsonPropertyName("firstBrokerLoginFlowAlias")] public string? FirstBrokerLoginFlowAlias { get; set; } - [JsonProperty("postBrokerLoginFlowAlias")] + [JsonPropertyName("postBrokerLoginFlowAlias")] public string? PostBrokerLoginFlowAlias { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string? DisplayName { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public Config? Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderInfo.cs b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderInfo.cs index 13afa26540..15043b5298 100644 --- a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderInfo.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; public class IdentityProviderInfo { - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderMapper.cs b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderMapper.cs index c0504046db..59ab80351a 100644 --- a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderMapper.cs +++ b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderMapper.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; public class IdentityProviderMapper { - [JsonProperty("config")] + [JsonPropertyName("config")] public IDictionary? Config { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("identityProviderAlias")] + [JsonPropertyName("identityProviderAlias")] public string? IdentityProviderAlias { get; set; } - [JsonProperty("identityProviderMapper")] + [JsonPropertyName("identityProviderMapper")] // ReSharper disable once InconsistentNaming public string? _IdentityProviderMapper { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderToken.cs b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderToken.cs index 33a7b3db4b..5dda22a59d 100644 --- a/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderToken.cs +++ b/src/keycloak/Keycloak.Library/Models/IdentityProviders/IdentityProviderToken.cs @@ -24,27 +24,27 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; public class IdentityProviderToken { - [JsonProperty("access_token")] + [JsonPropertyName("access_token")] public string AccessToken { get; set; } - [JsonProperty("token_type")] + [JsonPropertyName("token_type")] public string RequestingPartyToken { get; set; } - [JsonProperty("expires_in")] + [JsonPropertyName("expires_in")] public int ExpiresIn { get; set; } - [JsonProperty("refresh_token")] + [JsonPropertyName("refresh_token")] public string RefreshToken { get; set; } - [JsonProperty("scope")] + [JsonPropertyName("scope")] public string Scope { get; set; } - [JsonProperty("created_at")] + [JsonPropertyName("created_at")] public long CreatedAt { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Key/Active.cs b/src/keycloak/Keycloak.Library/Models/Key/Active.cs index 1cc51b79b9..5b0e61427b 100644 --- a/src/keycloak/Keycloak.Library/Models/Key/Active.cs +++ b/src/keycloak/Keycloak.Library/Models/Key/Active.cs @@ -24,16 +24,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Key; public class Active { - [JsonProperty("HS256")] + [JsonPropertyName("HS256")] public string Hs256 { get; set; } - [JsonProperty("RS256")] + [JsonPropertyName("RS256")] public string Rs256 { get; set; } - [JsonProperty("AES")] + [JsonPropertyName("AES")] public string Aes { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Key/Key.cs b/src/keycloak/Keycloak.Library/Models/Key/Key.cs index 60501953ef..48138086ce 100644 --- a/src/keycloak/Keycloak.Library/Models/Key/Key.cs +++ b/src/keycloak/Keycloak.Library/Models/Key/Key.cs @@ -24,26 +24,26 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Key; public class Key { - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string ProviderId { get; set; } - [JsonProperty("providerPriority")] + [JsonPropertyName("providerPriority")] public int? ProviderPriority { get; set; } - [JsonProperty("kid")] + [JsonPropertyName("kid")] public string Kid { get; set; } - [JsonProperty("status")] + [JsonPropertyName("status")] public string Status { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } - [JsonProperty("algorithm")] + [JsonPropertyName("algorithm")] public string Algorithm { get; set; } - [JsonProperty("publicKey")] + [JsonPropertyName("publicKey")] public string PublicKey { get; set; } - [JsonProperty("certificate")] + [JsonPropertyName("certificate")] public string Certificate { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Key/KeysMetadata.cs b/src/keycloak/Keycloak.Library/Models/Key/KeysMetadata.cs index 8e5478a2e9..61dc530468 100644 --- a/src/keycloak/Keycloak.Library/Models/Key/KeysMetadata.cs +++ b/src/keycloak/Keycloak.Library/Models/Key/KeysMetadata.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Key; public class KeysMetadata { - [JsonProperty("active")] + [JsonPropertyName("active")] public Active Active { get; set; } - [JsonProperty("keys")] + [JsonPropertyName("keys")] public IEnumerable Keys { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/OpenIDConfiguration/OpenIDConfiguration.cs b/src/keycloak/Keycloak.Library/Models/OpenIDConfiguration/OpenIDConfiguration.cs index b0af7d7fa9..49cfc3a10d 100644 --- a/src/keycloak/Keycloak.Library/Models/OpenIDConfiguration/OpenIDConfiguration.cs +++ b/src/keycloak/Keycloak.Library/Models/OpenIDConfiguration/OpenIDConfiguration.cs @@ -24,96 +24,96 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.OpenIDConfiguration; public class OpenIDConfiguration { - [JsonProperty("issuer")] + [JsonPropertyName("issuer")] public Uri Issuer { get; set; } - [JsonProperty("authorization_endpoint")] + [JsonPropertyName("authorization_endpoint")] public Uri AuthorizationEndpoint { get; set; } - [JsonProperty("token_endpoint")] + [JsonPropertyName("token_endpoint")] public Uri TokenEndpoint { get; set; } - [JsonProperty("token_introspection_endpoint")] + [JsonPropertyName("token_introspection_endpoint")] public Uri TokenIntrospectionEndpoint { get; set; } - [JsonProperty("userinfo_endpoint")] + [JsonPropertyName("userinfo_endpoint")] public Uri UserinfoEndpoint { get; set; } - [JsonProperty("end_session_endpoint")] + [JsonPropertyName("end_session_endpoint")] public Uri EndSessionEndpoint { get; set; } - [JsonProperty("jwks_uri")] + [JsonPropertyName("jwks_uri")] public Uri JwksUri { get; set; } - [JsonProperty("check_session_iframe")] + [JsonPropertyName("check_session_iframe")] public Uri CheckSessionIframe { get; set; } - [JsonProperty("grant_types_supported")] + [JsonPropertyName("grant_types_supported")] public string[] GrantTypesSupported { get; set; } - [JsonProperty("response_types_supported")] + [JsonPropertyName("response_types_supported")] public string[] ResponseTypesSupported { get; set; } - [JsonProperty("subject_types_supported")] + [JsonPropertyName("subject_types_supported")] public string[] SubjectTypesSupported { get; set; } - [JsonProperty("id_token_signing_alg_values_supported")] + [JsonPropertyName("id_token_signing_alg_values_supported")] public string[] IdTokenSigningAlgValuesSupported { get; set; } - [JsonProperty("id_token_encryption_alg_values_supported")] + [JsonPropertyName("id_token_encryption_alg_values_supported")] public string[] IdTokenEncryptionAlgValuesSupported { get; set; } - [JsonProperty("id_token_encryption_enc_values_supported")] + [JsonPropertyName("id_token_encryption_enc_values_supported")] public string[] IdTokenEncryptionEncValuesSupported { get; set; } - [JsonProperty("userinfo_signing_alg_values_supported")] + [JsonPropertyName("userinfo_signing_alg_values_supported")] public string[] UserinfoSigningAlgValuesSupported { get; set; } - [JsonProperty("request_object_signing_alg_values_supported")] + [JsonPropertyName("request_object_signing_alg_values_supported")] public string[] RequestObjectSigningAlgValuesSupported { get; set; } - [JsonProperty("response_modes_supported")] + [JsonPropertyName("response_modes_supported")] public string[] ResponseModesSupported { get; set; } - [JsonProperty("registration_endpoint")] + [JsonPropertyName("registration_endpoint")] public Uri RegistrationEndpoint { get; set; } - [JsonProperty("token_endpoint_auth_methods_supported")] + [JsonPropertyName("token_endpoint_auth_methods_supported")] public string[] TokenEndpointAuthMethodsSupported { get; set; } - [JsonProperty("token_endpoint_auth_signing_alg_values_supported")] + [JsonPropertyName("token_endpoint_auth_signing_alg_values_supported")] public string[] TokenEndpointAuthSigningAlgValuesSupported { get; set; } - [JsonProperty("claims_supported")] + [JsonPropertyName("claims_supported")] public string[] ClaimsSupported { get; set; } - [JsonProperty("claim_types_supported")] + [JsonPropertyName("claim_types_supported")] public string[] ClaimTypesSupported { get; set; } - [JsonProperty("claims_parameter_supported")] + [JsonPropertyName("claims_parameter_supported")] public bool ClaimsParameterSupported { get; set; } - [JsonProperty("scopes_supported")] + [JsonPropertyName("scopes_supported")] public string[] ScopesSupported { get; set; } - [JsonProperty("request_parameter_supported")] + [JsonPropertyName("request_parameter_supported")] public bool RequestParameterSupported { get; set; } - [JsonProperty("request_uri_parameter_supported")] + [JsonPropertyName("request_uri_parameter_supported")] public bool RequestUriParameterSupported { get; set; } - [JsonProperty("code_challenge_methods_supported")] + [JsonPropertyName("code_challenge_methods_supported")] public string[] CodeChallengeMethodsSupported { get; set; } - [JsonProperty("tls_client_certificate_bound_access_tokens")] + [JsonPropertyName("tls_client_certificate_bound_access_tokens")] public bool TlsClientCertificateBoundAccessTokens { get; set; } - [JsonProperty("introspection_endpoint")] + [JsonPropertyName("introspection_endpoint")] public Uri IntrospectionEndpoint { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ProtocolMappers/Config.cs b/src/keycloak/Keycloak.Library/Models/ProtocolMappers/Config.cs index 0407e72c71..8acf4eeec3 100644 --- a/src/keycloak/Keycloak.Library/Models/ProtocolMappers/Config.cs +++ b/src/keycloak/Keycloak.Library/Models/ProtocolMappers/Config.cs @@ -24,52 +24,52 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ProtocolMappers; public class Config { - [JsonProperty("single")] + [JsonPropertyName("single")] public string? Single { get; set; } - [JsonProperty("attribute.nameformat")] + [JsonPropertyName("attribute.nameformat")] public string? AttributeNameFormat { get; set; } - [JsonProperty("attribute.name")] + [JsonPropertyName("attribute.name")] public string? AttributeName { get; set; } - [JsonProperty("userinfo.token.claim")] + [JsonPropertyName("userinfo.token.claim")] public string? UserInfoTokenClaim { get; set; } - [JsonProperty("user.attribute")] + [JsonPropertyName("user.attribute")] public string? UserAttribute { get; set; } - [JsonProperty("id.token.claim")] + [JsonPropertyName("id.token.claim")] public string? IdTokenClaim { get; set; } - [JsonProperty("access.token.claim")] + [JsonPropertyName("access.token.claim")] public string? AccessTokenClaim { get; set; } - [JsonProperty("introspection.token.claim")] + [JsonPropertyName("introspection.token.claim")] public string? IntrospectionTokenClaim { get; set; } - [JsonProperty("lightweight.claim")] + [JsonPropertyName("lightweight.claim")] public string? LightweightClaim { get; set; } - [JsonProperty("claim.name")] + [JsonPropertyName("claim.name")] public string? ClaimName { get; set; } - [JsonProperty("jsonType.label")] + [JsonPropertyName("jsonType.label")] public string? JsonTypelabel { get; set; } - [JsonProperty("user.attribute.formatted")] + [JsonPropertyName("user.attribute.formatted")] public string? UserAttributeFormatted { get; set; } - [JsonProperty("user.attribute.country")] + [JsonPropertyName("user.attribute.country")] public string? UserAttributeCountry { get; set; } - [JsonProperty("user.attribute.postal_code")] + [JsonPropertyName("user.attribute.postal_code")] public string? UserAttributePostalCode { get; set; } - [JsonProperty("user.attribute.street")] + [JsonPropertyName("user.attribute.street")] public string? UserAttributeStreet { get; set; } - [JsonProperty("user.attribute.region")] + [JsonPropertyName("user.attribute.region")] public string? UserAttributeRegion { get; set; } - [JsonProperty("user.attribute.locality")] + [JsonPropertyName("user.attribute.locality")] public string? UserAttributeLocality { get; set; } - [JsonProperty("included.client.audience")] + [JsonPropertyName("included.client.audience")] public string? IncludedClientAudience { get; set; } - [JsonProperty("included.custom.audience")] + [JsonPropertyName("included.custom.audience")] public string? IncludedCustomAudience { get; set; } - [JsonProperty("multivalued")] + [JsonPropertyName("multivalued")] public string? Multivalued { get; set; } - [JsonProperty("user.session.note")] + [JsonPropertyName("user.session.note")] public string? UserSessionNote { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/ProtocolMappers/ProtocolMapper.cs b/src/keycloak/Keycloak.Library/Models/ProtocolMappers/ProtocolMapper.cs index ae6fdb5157..2068d0dd56 100644 --- a/src/keycloak/Keycloak.Library/Models/ProtocolMappers/ProtocolMapper.cs +++ b/src/keycloak/Keycloak.Library/Models/ProtocolMappers/ProtocolMapper.cs @@ -24,23 +24,23 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.ProtocolMappers; public class ProtocolMapper { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public string? Protocol { get; set; } - [JsonProperty("protocolMapper")] + [JsonPropertyName("protocolMapper")] // ReSharper disable once InconsistentNaming public string? _ProtocolMapper { get; set; } - [JsonProperty("consentRequired")] + [JsonPropertyName("consentRequired")] public bool? ConsentRequired { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public Config? Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AdminEvent.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AdminEvent.cs index 8aa19ce556..db20e803bb 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AdminEvent.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AdminEvent.cs @@ -24,26 +24,26 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class AdminEvent { - [JsonProperty("authDetails")] + [JsonPropertyName("authDetails")] public AuthDetails AuthDetails { get; set; } - [JsonProperty("error")] + [JsonPropertyName("error")] public string Error { get; set; } - [JsonProperty("operationType")] + [JsonPropertyName("operationType")] public string OperationType { get; set; } - [JsonProperty("realmId")] + [JsonPropertyName("realmId")] public string RealmId { get; set; } - [JsonProperty("representation")] + [JsonPropertyName("representation")] public string Representation { get; set; } - [JsonProperty("resourcePath")] + [JsonPropertyName("resourcePath")] public string ResourcePath { get; set; } - [JsonProperty("resourceType")] + [JsonPropertyName("resourceType")] public string ResourceType { get; set; } - [JsonProperty("time")] + [JsonPropertyName("time")] public int? Time { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Attributes.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Attributes.cs index b5a901da36..08c3c1474d 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Attributes.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Attributes.cs @@ -24,48 +24,48 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class Attributes { - [JsonProperty("_browser_headerxXSSProtection")] + [JsonPropertyName("_browser_headerxXSSProtection")] public string BrowserHeaderxXssProtection { get; set; } - [JsonProperty("_browser_headerxFrameOptions")] + [JsonPropertyName("_browser_headerxFrameOptions")] public string BrowserHeaderxFrameOptions { get; set; } - [JsonProperty("_browser_headerstrictTransportSecurity")] + [JsonPropertyName("_browser_headerstrictTransportSecurity")] public string BrowserHeaderstrictTransportSecurity { get; set; } - [JsonProperty("permanentLockout")] + [JsonPropertyName("permanentLockout")] public string PermanentLockout { get; set; } - [JsonProperty("quickLoginCheckMilliSeconds")] + [JsonPropertyName("quickLoginCheckMilliSeconds")] public string QuickLoginCheckMilliSeconds { get; set; } - [JsonProperty("_browser_headerxRobotsTag")] + [JsonPropertyName("_browser_headerxRobotsTag")] public string BrowserHeaderxRobotsTag { get; set; } - [JsonProperty("maxFailureWaitSeconds")] + [JsonPropertyName("maxFailureWaitSeconds")] public string MaxFailureWaitSeconds { get; set; } - [JsonProperty("minimumQuickLoginWaitSeconds")] + [JsonPropertyName("minimumQuickLoginWaitSeconds")] public string MinimumQuickLoginWaitSeconds { get; set; } - [JsonProperty("failureFactor")] + [JsonPropertyName("failureFactor")] public string FailureFactor { get; set; } - [JsonProperty("actionTokenGeneratedByUserLifespan")] + [JsonPropertyName("actionTokenGeneratedByUserLifespan")] public string ActionTokenGeneratedByUserLifespan { get; set; } - [JsonProperty("maxDeltaTimeSeconds")] + [JsonPropertyName("maxDeltaTimeSeconds")] public string MaxDeltaTimeSeconds { get; set; } - [JsonProperty("_browser_headerxContentTypeOptions")] + [JsonPropertyName("_browser_headerxContentTypeOptions")] public string BrowserHeaderxContentTypeOptions { get; set; } - [JsonProperty("offlineSessionMaxLifespan")] + [JsonPropertyName("offlineSessionMaxLifespan")] public string OfflineSessionMaxLifespan { get; set; } - [JsonProperty("actionTokenGeneratedByAdminLifespan")] + [JsonPropertyName("actionTokenGeneratedByAdminLifespan")] public string ActionTokenGeneratedByAdminLifespan { get; set; } - [JsonProperty("_browser_headercontentSecurityPolicyReportOnly")] + [JsonPropertyName("_browser_headercontentSecurityPolicyReportOnly")] public string BrowserHeadercontentSecurityPolicyReportOnly { get; set; } - [JsonProperty("bruteForceProtected")] + [JsonPropertyName("bruteForceProtected")] public string BruteForceProtected { get; set; } - [JsonProperty("_browser_headercontentSecurityPolicy")] + [JsonPropertyName("_browser_headercontentSecurityPolicy")] public string BrowserHeadercontentSecurityPolicy { get; set; } - [JsonProperty("waitIncrementSeconds")] + [JsonPropertyName("waitIncrementSeconds")] public string WaitIncrementSeconds { get; set; } - [JsonProperty("offlineSessionMaxLifespanEnabled")] + [JsonPropertyName("offlineSessionMaxLifespanEnabled")] public string OfflineSessionMaxLifespanEnabled { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AuthDetails.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AuthDetails.cs index 112d39eb91..d57fdd20b6 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AuthDetails.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/AuthDetails.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class AuthDetails { - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string ClientId { get; set; } - [JsonProperty("ipAddress")] + [JsonPropertyName("ipAddress")] public string IpAddress { get; set; } - [JsonProperty("realmId")] + [JsonPropertyName("realmId")] public string RealmId { get; set; } - [JsonProperty("userId")] + [JsonPropertyName("userId")] public string UserId { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/BrowserSecurityHeaders.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/BrowserSecurityHeaders.cs index 8232f7df8c..f654598c13 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/BrowserSecurityHeaders.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/BrowserSecurityHeaders.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class BrowserSecurityHeaders { - [JsonProperty("contentSecurityPolicyReportOnly")] + [JsonPropertyName("contentSecurityPolicyReportOnly")] public string? ContentSecurityPolicyReportOnly { get; set; } - [JsonProperty("xContentTypeOptions")] + [JsonPropertyName("xContentTypeOptions")] public string? XContentTypeOptions { get; set; } - [JsonProperty("xRobotsTag")] + [JsonPropertyName("xRobotsTag")] public string? XRobotsTag { get; set; } - [JsonProperty("xFrameOptions")] + [JsonPropertyName("xFrameOptions")] public string? XFrameOptions { get; set; } - [JsonProperty("xXSSProtection")] + [JsonPropertyName("xXSSProtection")] public string? XXssProtection { get; set; } - [JsonProperty("contentSecurityPolicy")] + [JsonPropertyName("contentSecurityPolicy")] public string? ContentSecurityPolicy { get; set; } - [JsonProperty("strictTransportSecurity")] + [JsonPropertyName("strictTransportSecurity")] public string? StrictTransportSecurity { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Config.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Config.cs index 08f7cd5f75..cc501ac564 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Config.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Config.cs @@ -24,20 +24,20 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class Config { - [JsonProperty("hideOnLoginPage")] + [JsonPropertyName("hideOnLoginPage")] public string? HideOnLoginPage { get; set; } - [JsonProperty("clientSecret")] + [JsonPropertyName("clientSecret")] public string? ClientSecret { get; set; } - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string? ClientId { get; set; } - [JsonProperty("disableUserInfo")] + [JsonPropertyName("disableUserInfo")] public string? DisableUserInfo { get; set; } - [JsonProperty("useJwksUrl")] + [JsonPropertyName("useJwksUrl")] public string? UseJwksUrl { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Event.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Event.cs index 14b2487967..08fe84b2d1 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Event.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Event.cs @@ -24,28 +24,28 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class Event { - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string ClientId { get; set; } - [JsonProperty("details")] + [JsonPropertyName("details")] public IDictionary Details { get; set; } - [JsonProperty("error")] + [JsonPropertyName("error")] public string Error { get; set; } - [JsonProperty("ipAddress")] + [JsonPropertyName("ipAddress")] public string IpAddress { get; set; } - [JsonProperty("realmId")] + [JsonPropertyName("realmId")] public string RealmId { get; set; } - [JsonProperty("sessionId")] + [JsonPropertyName("sessionId")] public string SessionId { get; set; } - [JsonProperty("time")] + [JsonPropertyName("time")] public long Time { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } - [JsonProperty("userId")] + [JsonPropertyName("userId")] public string UserId { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/IdentityProvider.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/IdentityProvider.cs index f2dc2c9030..e199380349 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/IdentityProvider.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/IdentityProvider.cs @@ -24,36 +24,36 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class IdentityProvider { - [JsonProperty("alias")] + [JsonPropertyName("alias")] public string? Alias { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string? DisplayName { get; set; } - [JsonProperty("internalId")] + [JsonPropertyName("internalId")] public string? InternalId { get; set; } - [JsonProperty("providerId")] + [JsonPropertyName("providerId")] public string? ProviderId { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("updateProfileFirstLoginMode")] + [JsonPropertyName("updateProfileFirstLoginMode")] public string? UpdateProfileFirstLoginMode { get; set; } - [JsonProperty("trustEmail")] + [JsonPropertyName("trustEmail")] public bool? TrustEmail { get; set; } - [JsonProperty("storeToken")] + [JsonPropertyName("storeToken")] public bool? StoreToken { get; set; } - [JsonProperty("addReadTokenRoleOnCreate")] + [JsonPropertyName("addReadTokenRoleOnCreate")] public bool? AddReadTokenRoleOnCreate { get; set; } - [JsonProperty("authenticateByDefault")] + [JsonPropertyName("authenticateByDefault")] public bool? AuthenticateByDefault { get; set; } - [JsonProperty("linkOnly")] + [JsonPropertyName("linkOnly")] public bool? LinkOnly { get; set; } - [JsonProperty("firstBrokerLoginFlowAlias")] + [JsonPropertyName("firstBrokerLoginFlowAlias")] public string? FirstBrokerLoginFlowAlias { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public Config? Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/PartialImport.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/PartialImport.cs index 71f3b901fb..389180f512 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/PartialImport.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/PartialImport.cs @@ -24,11 +24,11 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Groups; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; @@ -38,7 +38,7 @@ public class PartialImport public IEnumerable? Groups { get; set; } public IEnumerable? IdentityProviders { get; set; } public string? IfResourceExists { get; set; } - [JsonConverter(typeof(PoliciesConverter))] + [JsonConverter(typeof(EnumMemberConverter))] public Policies? Policy { get; set; } public Roles? Roles { get; set; } public IEnumerable? Users { get; set; } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Policies.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Policies.cs index 73ef44a6ff..0e0eda6fb3 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Policies.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Policies.cs @@ -24,11 +24,18 @@ * SOFTWARE. ********************************************************************************/ +using System.Runtime.Serialization; + namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public enum Policies { + [EnumMember(Value = "SKIP")] Skip, + + [EnumMember(Value = "OVERWRITE")] Overwrite, + + [EnumMember(Value = "FAIL")] Fail } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Realm.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Realm.cs index 57aff0d39d..cd311b5ed0 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Realm.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Realm.cs @@ -24,156 +24,156 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class Realm { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("realm")] + [JsonPropertyName("realm")] // ReSharper disable once InconsistentNaming public string? _Realm { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string? DisplayName { get; set; } - [JsonProperty("displayNameHtml")] + [JsonPropertyName("displayNameHtml")] public string? DisplayNameHtml { get; set; } - [JsonProperty("notBefore")] + [JsonPropertyName("notBefore")] public int? NotBefore { get; set; } - [JsonProperty("defaultSignatureAlgorithm")] + [JsonPropertyName("defaultSignatureAlgorithm")] public string? DefaultSignatureAlgorithm { get; set; } - [JsonProperty("revokeRefreshToken")] + [JsonPropertyName("revokeRefreshToken")] public bool? RevokeRefreshToken { get; set; } - [JsonProperty("refreshTokenMaxReuse")] + [JsonPropertyName("refreshTokenMaxReuse")] public int? RefreshTokenMaxReuse { get; set; } - [JsonProperty("accessTokenLifespan")] + [JsonPropertyName("accessTokenLifespan")] public int? AccessTokenLifespan { get; set; } - [JsonProperty("accessTokenLifespanForImplicitFlow")] + [JsonPropertyName("accessTokenLifespanForImplicitFlow")] public int? AccessTokenLifespanForImplicitFlow { get; set; } - [JsonProperty("ssoSessionIdleTimeout")] + [JsonPropertyName("ssoSessionIdleTimeout")] public int? SsoSessionIdleTimeout { get; set; } - [JsonProperty("ssoSessionMaxLifespan")] + [JsonPropertyName("ssoSessionMaxLifespan")] public int? SsoSessionMaxLifespan { get; set; } - [JsonProperty("ssoSessionIdleTimeoutRememberMe")] + [JsonPropertyName("ssoSessionIdleTimeoutRememberMe")] public int? SsoSessionIdleTimeoutRememberMe { get; set; } - [JsonProperty("ssoSessionMaxLifespanRememberMe")] + [JsonPropertyName("ssoSessionMaxLifespanRememberMe")] public int? SsoSessionMaxLifespanRememberMe { get; set; } - [JsonProperty("offlineSessionIdleTimeout")] + [JsonPropertyName("offlineSessionIdleTimeout")] public int? OfflineSessionIdleTimeout { get; set; } - [JsonProperty("offlineSessionMaxLifespanEnabled")] + [JsonPropertyName("offlineSessionMaxLifespanEnabled")] public bool? OfflineSessionMaxLifespanEnabled { get; set; } - [JsonProperty("offlineSessionMaxLifespan")] + [JsonPropertyName("offlineSessionMaxLifespan")] public int? OfflineSessionMaxLifespan { get; set; } - [JsonProperty("accessCodeLifespan")] + [JsonPropertyName("accessCodeLifespan")] public int? AccessCodeLifespan { get; set; } - [JsonProperty("accessCodeLifespanUserAction")] + [JsonPropertyName("accessCodeLifespanUserAction")] public int? AccessCodeLifespanUserAction { get; set; } - [JsonProperty("accessCodeLifespanLogin")] + [JsonPropertyName("accessCodeLifespanLogin")] public int? AccessCodeLifespanLogin { get; set; } - [JsonProperty("actionTokenGeneratedByAdminLifespan")] + [JsonPropertyName("actionTokenGeneratedByAdminLifespan")] public int? ActionTokenGeneratedByAdminLifespan { get; set; } - [JsonProperty("actionTokenGeneratedByUserLifespan")] + [JsonPropertyName("actionTokenGeneratedByUserLifespan")] public int? ActionTokenGeneratedByUserLifespan { get; set; } - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("sslRequired")] + [JsonPropertyName("sslRequired")] public string? SslRequired { get; set; } - [JsonProperty("registrationAllowed")] + [JsonPropertyName("registrationAllowed")] public bool? RegistrationAllowed { get; set; } - [JsonProperty("registrationEmailAsUsername")] + [JsonPropertyName("registrationEmailAsUsername")] public bool? RegistrationEmailAsUsername { get; set; } - [JsonProperty("rememberMe")] + [JsonPropertyName("rememberMe")] public bool? RememberMe { get; set; } - [JsonProperty("verifyEmail")] + [JsonPropertyName("verifyEmail")] public bool? VerifyEmail { get; set; } - [JsonProperty("loginWithEmailAllowed")] + [JsonPropertyName("loginWithEmailAllowed")] public bool? LoginWithEmailAllowed { get; set; } - [JsonProperty("duplicateEmailsAllowed")] + [JsonPropertyName("duplicateEmailsAllowed")] public bool? DuplicateEmailsAllowed { get; set; } - [JsonProperty("resetPasswordAllowed")] + [JsonPropertyName("resetPasswordAllowed")] public bool? ResetPasswordAllowed { get; set; } - [JsonProperty("editUsernameAllowed")] + [JsonPropertyName("editUsernameAllowed")] public bool? EditUsernameAllowed { get; set; } - [JsonProperty("bruteForceProtected")] + [JsonPropertyName("bruteForceProtected")] public bool? BruteForceProtected { get; set; } - [JsonProperty("permanentLockout")] + [JsonPropertyName("permanentLockout")] public bool? PermanentLockout { get; set; } - [JsonProperty("maxFailureWaitSeconds")] + [JsonPropertyName("maxFailureWaitSeconds")] public int? MaxFailureWaitSeconds { get; set; } - [JsonProperty("minimumQuickLoginWaitSeconds")] + [JsonPropertyName("minimumQuickLoginWaitSeconds")] public int? MinimumQuickLoginWaitSeconds { get; set; } - [JsonProperty("waitIncrementSeconds")] + [JsonPropertyName("waitIncrementSeconds")] public int? WaitIncrementSeconds { get; set; } - [JsonProperty("quickLoginCheckMilliSeconds")] + [JsonPropertyName("quickLoginCheckMilliSeconds")] public int? QuickLoginCheckMilliSeconds { get; set; } - [JsonProperty("maxDeltaTimeSeconds")] + [JsonPropertyName("maxDeltaTimeSeconds")] public int? MaxDeltaTimeSeconds { get; set; } - [JsonProperty("failureFactor")] + [JsonPropertyName("failureFactor")] public int? FailureFactor { get; set; } - [JsonProperty("defaultRole")] + [JsonPropertyName("defaultRole")] public Role? DefaultRole { get; set; } - [JsonProperty("requiredCredentials")] + [JsonPropertyName("requiredCredentials")] public IEnumerable? RequiredCredentials { get; set; } - [JsonProperty("otpPolicyType")] + [JsonPropertyName("otpPolicyType")] public string? OtpPolicyType { get; set; } - [JsonProperty("otpPolicyAlgorithm")] + [JsonPropertyName("otpPolicyAlgorithm")] public string? OtpPolicyAlgorithm { get; set; } - [JsonProperty("otpPolicyInitialCounter")] + [JsonPropertyName("otpPolicyInitialCounter")] public int? OtpPolicyInitialCounter { get; set; } - [JsonProperty("otpPolicyDigits")] + [JsonPropertyName("otpPolicyDigits")] public int? OtpPolicyDigits { get; set; } - [JsonProperty("otpPolicyLookAheadWindow")] + [JsonPropertyName("otpPolicyLookAheadWindow")] public int? OtpPolicyLookAheadWindow { get; set; } - [JsonProperty("otpPolicyPeriod")] + [JsonPropertyName("otpPolicyPeriod")] public int? OtpPolicyPeriod { get; set; } - [JsonProperty("otpSupportedApplications")] + [JsonPropertyName("otpSupportedApplications")] public IEnumerable? OtpSupportedApplications { get; set; } - [JsonProperty("browserSecurityHeaders")] + [JsonPropertyName("browserSecurityHeaders")] public BrowserSecurityHeaders? BrowserSecurityHeaders { get; set; } - [JsonProperty("smtpServer")] + [JsonPropertyName("smtpServer")] public SmtpServer? SmtpServer { get; set; } - [JsonProperty("loginTheme")] + [JsonPropertyName("loginTheme")] public string? LoginTheme { get; set; } - [JsonProperty("accountTheme")] + [JsonPropertyName("accountTheme")] public string? AccountTheme { get; set; } - [JsonProperty("adminTheme")] + [JsonPropertyName("adminTheme")] public string? AdminTheme { get; set; } - [JsonProperty("emailTheme")] + [JsonPropertyName("emailTheme")] public string? EmailTheme { get; set; } - [JsonProperty("eventsEnabled")] + [JsonPropertyName("eventsEnabled")] public bool? EventsEnabled { get; set; } - [JsonProperty("eventsListeners")] + [JsonPropertyName("eventsListeners")] public IEnumerable? EventsListeners { get; set; } - [JsonProperty("enabledEventTypes")] + [JsonPropertyName("enabledEventTypes")] public IEnumerable? EnabledEventTypes { get; set; } - [JsonProperty("adminEventsEnabled")] + [JsonPropertyName("adminEventsEnabled")] public bool? AdminEventsEnabled { get; set; } - [JsonProperty("adminEventsDetailsEnabled")] + [JsonPropertyName("adminEventsDetailsEnabled")] public bool? AdminEventsDetailsEnabled { get; set; } - [JsonProperty("identityProviders")] + [JsonPropertyName("identityProviders")] public IEnumerable? IdentityProviders { get; set; } - [JsonProperty("internationalizationEnabled")] + [JsonPropertyName("internationalizationEnabled")] public bool? InternationalizationEnabled { get; set; } - [JsonProperty("supportedLocales")] + [JsonPropertyName("supportedLocales")] public IEnumerable? SupportedLocales { get; set; } - [JsonProperty("browserFlow")] + [JsonPropertyName("browserFlow")] public string? BrowserFlow { get; set; } - [JsonProperty("registrationFlow")] + [JsonPropertyName("registrationFlow")] public string? RegistrationFlow { get; set; } - [JsonProperty("directGrantFlow")] + [JsonPropertyName("directGrantFlow")] public string? DirectGrantFlow { get; set; } - [JsonProperty("resetCredentialsFlow")] + [JsonPropertyName("resetCredentialsFlow")] public string? ResetCredentialsFlow { get; set; } - [JsonProperty("clientAuthenticationFlow")] + [JsonPropertyName("clientAuthenticationFlow")] public string? ClientAuthenticationFlow { get; set; } - [JsonProperty("dockerAuthenticationFlow")] + [JsonPropertyName("dockerAuthenticationFlow")] public string? DockerAuthenticationFlow { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public IDictionary? Attributes { get; set; } - [JsonProperty("userManagedAccessAllowed")] + [JsonPropertyName("userManagedAccessAllowed")] public bool? UserManagedAccessAllowed { get; set; } - [JsonProperty("passwordPolicy")] + [JsonPropertyName("passwordPolicy")] public string? PasswordPolicy { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/RealmEventsConfig.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/RealmEventsConfig.cs index dbeadbcfaa..f6bcf227a0 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/RealmEventsConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/RealmEventsConfig.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class RealmEventsConfig { - [JsonProperty("adminEventsDetailsEnabled")] + [JsonPropertyName("adminEventsDetailsEnabled")] public bool? AdminEventsDetailsEnabled { get; set; } - [JsonProperty("adminEventsEnabled")] + [JsonPropertyName("adminEventsEnabled")] public bool? AdminEventsEnabled { get; set; } - [JsonProperty("enabledEventsTypes")] + [JsonPropertyName("enabledEventsTypes")] public IEnumerable EnabledEventsTypes { get; set; } - [JsonProperty("eventsEnabled")] + [JsonPropertyName("eventsEnabled")] public bool? EventsEnabled { get; set; } - [JsonProperty("eventsExpiration")] + [JsonPropertyName("eventsExpiration")] public long? EventsExpiration { get; set; } - [JsonProperty("eventsListeners")] + [JsonPropertyName("eventsListeners")] public IEnumerable EventsListeners { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Roles.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Roles.cs index d5381e2594..d42aca77f6 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Roles.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/Roles.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class Roles { - [JsonProperty("client")] + [JsonPropertyName("client")] public IDictionary Client { get; set; } - [JsonProperty("realm")] + [JsonPropertyName("realm")] public IEnumerable Realm { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/SmtpServer.cs b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/SmtpServer.cs index c32da00342..4b427c545c 100644 --- a/src/keycloak/Keycloak.Library/Models/RealmsAdmin/SmtpServer.cs +++ b/src/keycloak/Keycloak.Library/Models/RealmsAdmin/SmtpServer.cs @@ -24,34 +24,34 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; public class SmtpServer { - [JsonProperty("host")] + [JsonPropertyName("host")] public string? Host { get; set; } - [JsonProperty("ssl")] + [JsonPropertyName("ssl")] public string? Ssl { get; set; } - [JsonProperty("starttls")] + [JsonPropertyName("starttls")] public string? StartTls { get; set; } - [JsonProperty("user")] + [JsonPropertyName("user")] public string? User { get; set; } - [JsonProperty("password")] + [JsonPropertyName("password")] public string? Password { get; set; } - [JsonProperty("auth")] + [JsonPropertyName("auth")] public string? Auth { get; set; } - [JsonProperty("from")] + [JsonPropertyName("from")] public string? From { get; set; } - [JsonProperty("fromDisplayName")] + [JsonPropertyName("fromDisplayName")] public string? FromDisplayName { get; set; } - [JsonProperty("replyTo")] + [JsonPropertyName("replyTo")] public string? ReplyTo { get; set; } - [JsonProperty("replyToDisplayName")] + [JsonPropertyName("replyToDisplayName")] public string? ReplyToDisplayName { get; set; } - [JsonProperty("envelopeFrom")] + [JsonPropertyName("envelopeFrom")] public string? EnvelopeFrom { get; set; } - [JsonProperty("port")] + [JsonPropertyName("port")] public string? Port { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Roles/Role.cs b/src/keycloak/Keycloak.Library/Models/Roles/Role.cs index 202c5d36a0..f368e77422 100644 --- a/src/keycloak/Keycloak.Library/Models/Roles/Role.cs +++ b/src/keycloak/Keycloak.Library/Models/Roles/Role.cs @@ -24,26 +24,26 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; public class Role { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string? Name { get; set; } - [JsonProperty("description")] + [JsonPropertyName("description")] public string? Description { get; set; } - [JsonProperty("composite")] + [JsonPropertyName("composite")] public bool? Composite { get; set; } - [JsonProperty("composites")] + [JsonPropertyName("composites")] public RoleComposite? Composites { get; set; } - [JsonProperty("clientRole")] + [JsonPropertyName("clientRole")] public bool? ClientRole { get; set; } - [JsonProperty("containerId")] + [JsonPropertyName("containerId")] public string? ContainerId { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public IDictionary>? Attributes { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Roles/RoleComposite.cs b/src/keycloak/Keycloak.Library/Models/Roles/RoleComposite.cs index fdb8f73231..6cdee37541 100644 --- a/src/keycloak/Keycloak.Library/Models/Roles/RoleComposite.cs +++ b/src/keycloak/Keycloak.Library/Models/Roles/RoleComposite.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; public class RoleComposite { - [JsonProperty("client")] + [JsonPropertyName("client")] public IDictionary>? Client { get; set; } - [JsonProperty("realm")] + [JsonPropertyName("realm")] public IEnumerable? Realm { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Account.cs b/src/keycloak/Keycloak.Library/Models/Root/Account.cs index 9a392f91cc..ceb309519d 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Account.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Account.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Account { - [JsonProperty("name")] + [JsonPropertyName("name")] public Name Name { get; set; } - [JsonProperty("locales")] + [JsonPropertyName("locales")] public List Locales { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/AccountProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/AccountProviders.cs index 01f0f8fbc7..5f620a9fec 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/AccountProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/AccountProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class AccountProviders { - [JsonProperty("freemarker")] + [JsonPropertyName("freemarker")] public HasOrder Freemarker { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ActionToken.cs b/src/keycloak/Keycloak.Library/Models/Root/ActionToken.cs index 76537f0215..4e02050951 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ActionToken.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ActionToken.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ActionToken { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ActionTokenProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandler.cs b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandler.cs index 7f9266196b..68dce4546f 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandler.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandler.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ActionTokenHandler { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ActionTokenHandlerProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandlerProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandlerProviders.cs index 532760fa7b..3a97e3e82e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandlerProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenHandlerProviders.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ActionTokenHandlerProviders { - [JsonProperty("verify-email")] + [JsonPropertyName("verify-email")] public HasOrder VerifyEmail { get; set; } - [JsonProperty("execute-actions")] + [JsonPropertyName("execute-actions")] public HasOrder ExecuteActions { get; set; } - [JsonProperty("reset-credentials")] + [JsonPropertyName("reset-credentials")] public HasOrder ResetCredentials { get; set; } - [JsonProperty("idp-verify-account-via-email")] + [JsonPropertyName("idp-verify-account-via-email")] public HasOrder IdpVerifyAccountViaEmail { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenProviders.cs index 27be5ff6de..5ce4652bb9 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ActionTokenProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ActionTokenProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ActionTokenProviders { - [JsonProperty("infinispan")] + [JsonPropertyName("infinispan")] public HasOrder Infinispan { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Authenticator.cs b/src/keycloak/Keycloak.Library/Models/Root/Authenticator.cs index da08675e4a..00b686af7e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Authenticator.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Authenticator.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Authenticator { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public Dictionary Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Authorization.cs b/src/keycloak/Keycloak.Library/Models/Root/Authorization.cs index 4d4fae7cc6..4f5c5fe511 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Authorization.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Authorization.cs @@ -24,14 +24,14 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Authorization { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public AuthorizationProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationCache.cs b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationCache.cs index 9f2e52650f..582a46c60f 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationCache.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationCache.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class AuthorizationCache { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public HasDefault Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersister.cs b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersister.cs index 93539d12bd..3f4a564ad7 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersister.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersister.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class AuthorizationPersister { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public AuthorizationPersisterProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersisterProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersisterProviders.cs index 086706b183..2c420963b7 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersisterProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationPersisterProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class AuthorizationPersisterProviders { - [JsonProperty("jpa")] + [JsonPropertyName("jpa")] public HasOrder Jpa { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationProviders.cs index 21ff8540b6..951bdf1139 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/AuthorizationProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/AuthorizationProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class AuthorizationProviders { - [JsonProperty("authorization")] + [JsonPropertyName("authorization")] public HasOrder Authorization { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtector.cs b/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtector.cs index 89586ecf80..9296e8b61c 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtector.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtector.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class BruteForceProtector { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public BruteForceProtectorProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtectorProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtectorProviders.cs index c498ebebec..009336c69e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtectorProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/BruteForceProtectorProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class BruteForceProtectorProviders { - [JsonProperty("default-brute-force-detector")] + [JsonPropertyName("default-brute-force-detector")] public HasOrder DefaultBruteForceDetector { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/BuiltinProtocolMappers.cs b/src/keycloak/Keycloak.Library/Models/Root/BuiltinProtocolMappers.cs index f1a5a306a8..d56f451541 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/BuiltinProtocolMappers.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/BuiltinProtocolMappers.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class BuiltinProtocolMappers { - [JsonProperty("saml")] + [JsonPropertyName("saml")] public List Saml { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public List OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Category.cs b/src/keycloak/Keycloak.Library/Models/Root/Category.cs index c687baf2f3..b914090a75 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Category.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Category.cs @@ -24,17 +24,27 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(CategoryConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum Category { + [EnumMember(Value = "attribute statement mapper")] AttributeStatementMapper, + + [EnumMember(Value = "docker auth mapper")] DockerAuthMapper, + + [EnumMember(Value = "group mapper")] GroupMapper, + + [EnumMember(Value = "role mapper")] RoleMapper, + + [EnumMember(Value = "token mapper")] TokenMapper } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticator.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticator.cs index 16584770eb..31b7e634af 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticator.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticator.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientAuthenticator { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ClientAuthenticatorProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticatorProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticatorProviders.cs index f7e38cdd49..ac43ed0716 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticatorProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientAuthenticatorProviders.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientAuthenticatorProviders { - [JsonProperty("client-jwt")] + [JsonPropertyName("client-jwt")] public HasOrder ClientJwt { get; set; } - [JsonProperty("client-secret")] + [JsonPropertyName("client-secret")] public HasOrder ClientSecret { get; set; } - [JsonProperty("client-x509")] + [JsonPropertyName("client-x509")] public HasOrder ClientX509 { get; set; } - [JsonProperty("client-secret-jwt")] + [JsonPropertyName("client-secret-jwt")] public HasOrder ClientSecretJwt { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverter.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverter.cs index c036627edb..4ca840ec71 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverter.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverter.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientDescriptionConverter { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ClientDescriptionConverterProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverterProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverterProviders.cs index dea3b9e901..a6aeecd072 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverterProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientDescriptionConverterProviders.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientDescriptionConverterProviders { - [JsonProperty("keycloak")] + [JsonPropertyName("keycloak")] public HasOrder Keycloak { get; set; } - [JsonProperty("saml2-entity-descriptor")] + [JsonPropertyName("saml2-entity-descriptor")] public HasOrder Saml2EntityDescriptor { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public HasOrder OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientInstallation.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientInstallation.cs index b15823e801..aa10aacbcf 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientInstallation.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientInstallation.cs @@ -24,30 +24,30 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientInstallation { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public Protocol Protocol { get; set; } - [JsonProperty("downloadOnly")] + [JsonPropertyName("downloadOnly")] public bool? DownloadOnly { get; set; } - [JsonProperty("displayType")] + [JsonPropertyName("displayType")] public string DisplayType { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("filename")] + [JsonPropertyName("filename")] public string FileName { get; set; } - [JsonProperty("mediaType")] + [JsonPropertyName("mediaType")] public string MediaType { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientInstallations.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientInstallations.cs index 91994983f3..6f8008544d 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientInstallations.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientInstallations.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientInstallations { - [JsonProperty("docker-v2")] + [JsonPropertyName("docker-v2")] public List DockerV2 { get; set; } - [JsonProperty("saml")] + [JsonPropertyName("saml")] public List Saml { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public List OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistration.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistration.cs index 517ccbff1f..cc4f7d3226 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistration.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistration.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientRegistration { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ClientRegistrationProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicy.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicy.cs index 3861d2d109..d659b6d4ba 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicy.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicy.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientRegistrationPolicy { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ClientRegistrationPolicyProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicyProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicyProviders.cs index 130358e784..c1cdd92887 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicyProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationPolicyProviders.cs @@ -24,30 +24,30 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientRegistrationPolicyProviders { - [JsonProperty("allowed-client-templates")] + [JsonPropertyName("allowed-client-templates")] public HasOrder AllowedClientTemplates { get; set; } - [JsonProperty("client-disabled")] + [JsonPropertyName("client-disabled")] public HasOrder ClientDisabled { get; set; } - [JsonProperty("max-clients")] + [JsonPropertyName("max-clients")] public HasOrder MaxClients { get; set; } - [JsonProperty("scope")] + [JsonPropertyName("scope")] public HasOrder Scope { get; set; } - [JsonProperty("allowed-protocol-mappers")] + [JsonPropertyName("allowed-protocol-mappers")] public HasOrder AllowedProtocolMappers { get; set; } - [JsonProperty("trusted-hosts")] + [JsonPropertyName("trusted-hosts")] public HasOrder TrustedHosts { get; set; } - [JsonProperty("consent-required")] + [JsonPropertyName("consent-required")] public HasOrder ConsentRequired { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationProviders.cs index ab2ff3f2be..7c67cc9654 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientRegistrationProviders.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientRegistrationProviders { - [JsonProperty("default")] + [JsonPropertyName("default")] public HasOrder Default { get; set; } - [JsonProperty("install")] + [JsonPropertyName("install")] public HasOrder Install { get; set; } - [JsonProperty("saml2-entity-descriptor")] + [JsonPropertyName("saml2-entity-descriptor")] public HasOrder Saml2EntityDescriptor { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public HasOrder OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ClientStorage.cs b/src/keycloak/Keycloak.Library/Models/Root/ClientStorage.cs index ee051a86e0..7e72bb6322 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ClientStorage.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ClientStorage.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ClientStorage { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public MetadataClass Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Common.cs b/src/keycloak/Keycloak.Library/Models/Root/Common.cs index 011eb8b273..5a8791c6d9 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Common.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Common.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Common { - [JsonProperty("name")] + [JsonPropertyName("name")] public Name Name { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ComponentTypes.cs b/src/keycloak/Keycloak.Library/Models/Root/ComponentTypes.cs index 1c4f1f0b3e..93a411c440 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ComponentTypes.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ComponentTypes.cs @@ -24,39 +24,39 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ComponentTypes { - [JsonProperty("org.keycloak.authentication.ClientAuthenticator")] + [JsonPropertyName("org.keycloak.authentication.ClientAuthenticator")] public List OrgKeycloakAuthenticationClientAuthenticator { get; set; } - [JsonProperty("org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy")] + [JsonPropertyName("org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy")] public List OrgKeycloakServicesClientregistrationPolicyClientRegistrationPolicy { get; set; } - [JsonProperty("org.keycloak.authentication.FormAction")] + [JsonPropertyName("org.keycloak.authentication.FormAction")] public List OrgKeycloakAuthenticationFormAction { get; set; } - [JsonProperty("org.keycloak.authentication.Authenticator")] + [JsonPropertyName("org.keycloak.authentication.Authenticator")] public List OrgKeycloakAuthenticationAuthenticator { get; set; } - [JsonProperty("org.keycloak.storage.UserStorageProvider")] + [JsonPropertyName("org.keycloak.storage.UserStorageProvider")] public List OrgKeycloakStorageUserStorageProvider { get; set; } - [JsonProperty("org.keycloak.keys.KeyProvider")] + [JsonPropertyName("org.keycloak.keys.KeyProvider")] public List OrgKeycloakKeysKeyProvider { get; set; } - [JsonProperty("org.keycloak.storage.ldap.mappers.LDAPStorageMapper")] + [JsonPropertyName("org.keycloak.storage.ldap.mappers.LDAPStorageMapper")] public List OrgKeycloakStorageLdapMappersLdapStorageMapper { get; set; } - [JsonProperty("org.keycloak.authentication.FormAuthenticator")] + [JsonPropertyName("org.keycloak.authentication.FormAuthenticator")] public List OrgKeycloakAuthenticationFormAuthenticator { get; set; } - [JsonProperty("org.keycloak.protocol.ProtocolMapper")] + [JsonPropertyName("org.keycloak.protocol.ProtocolMapper")] public List OrgKeycloakProtocolProtocolMapper { get; set; } - [JsonProperty("org.keycloak.broker.provider.IdentityProviderMapper")] + [JsonPropertyName("org.keycloak.broker.provider.IdentityProviderMapper")] public List OrgKeycloakBrokerProviderIdentityProviderMapper { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ConfigType.cs b/src/keycloak/Keycloak.Library/Models/Root/ConfigType.cs index 3994183791..d88575deb4 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ConfigType.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ConfigType.cs @@ -24,14 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(ConfigTypeConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum ConfigType { + [EnumMember(Value = "int")] Int, + + [EnumMember(Value = "string")] String } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpa.cs b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpa.cs index cc42f578c9..2147b70070 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpa.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpa.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ConnectionsJpa { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ConnectionsJpaProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaProviders.cs index bcf0f28b9c..9b2b1a013d 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ConnectionsJpaProviders { - [JsonProperty("default")] + [JsonPropertyName("default")] public Default Default { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdater.cs b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdater.cs index c34fb8e189..4f53c3412e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdater.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdater.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ConnectionsJpaUpdater { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ConnectionsJpaUpdaterProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdaterProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdaterProviders.cs index 34d346900e..4e1746e42b 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdaterProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ConnectionsJpaUpdaterProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ConnectionsJpaUpdaterProviders { - [JsonProperty("liquibase")] + [JsonPropertyName("liquibase")] public HasOrder Liquibase { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Credential.cs b/src/keycloak/Keycloak.Library/Models/Root/Credential.cs index 72ea5f25e1..b4b4aa0b13 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Credential.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Credential.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Credential { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public CredentialProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/CredentialProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/CredentialProviders.cs index a878231958..aff904f19d 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/CredentialProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/CredentialProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class CredentialProviders { - [JsonProperty("keycloak-otp")] + [JsonPropertyName("keycloak-otp")] public HasOrder KeycloakOtp { get; set; } - [JsonProperty("keycloak-password")] + [JsonPropertyName("keycloak-password")] public HasOrder KeycloakPassword { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Default.cs b/src/keycloak/Keycloak.Library/Models/Root/Default.cs index 328b8fc73d..e2ff5a5cdd 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Default.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Default.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Default { - [JsonProperty("order")] + [JsonPropertyName("order")] public long Order { get; set; } - [JsonProperty("operationalInfo")] + [JsonPropertyName("operationalInfo")] public OperationalInfo OperationalInfo { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/EmailTemplateClass.cs b/src/keycloak/Keycloak.Library/Models/Root/EmailTemplateClass.cs index 166b5b37e3..621db0c994 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/EmailTemplateClass.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/EmailTemplateClass.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class EmailTemplateClass { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public AccountProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Enums.cs b/src/keycloak/Keycloak.Library/Models/Root/Enums.cs index ab8f08c0da..5880b56d97 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Enums.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Enums.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Enums { - [JsonProperty("operationType")] + [JsonPropertyName("operationType")] public List OperationType { get; set; } - [JsonProperty("eventType")] + [JsonPropertyName("eventType")] public List EventType { get; set; } - [JsonProperty("resourceType")] + [JsonPropertyName("resourceType")] public List ResourceType { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/EventsListener.cs b/src/keycloak/Keycloak.Library/Models/Root/EventsListener.cs index 03607cc25b..04dd81c65a 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/EventsListener.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/EventsListener.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class EventsListener { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public EventsListenerProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/EventsListenerProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/EventsListenerProviders.cs index 742ccb4e99..00ce97d9a7 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/EventsListenerProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/EventsListenerProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class EventsListenerProviders { - [JsonProperty("jboss-logging")] + [JsonPropertyName("jboss-logging")] public HasOrder JbossLogging { get; set; } - [JsonProperty("email")] + [JsonPropertyName("email")] public HasOrder Email { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ExportProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ExportProviders.cs index a5b617b308..ec1e30e9d0 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ExportProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ExportProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ExportProviders { - [JsonProperty("singleFile")] + [JsonPropertyName("singleFile")] public HasOrder SingleFile { get; set; } - [JsonProperty("dir")] + [JsonPropertyName("dir")] public HasOrder Dir { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/FormAction.cs b/src/keycloak/Keycloak.Library/Models/Root/FormAction.cs index debb0a369c..80006fb888 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/FormAction.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/FormAction.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class FormAction { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public FormActionProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/FormActionProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/FormActionProviders.cs index e2a3a16484..0d07a5dc42 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/FormActionProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/FormActionProviders.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class FormActionProviders { - [JsonProperty("registration-profile-action")] + [JsonPropertyName("registration-profile-action")] public HasOrder RegistrationProfileAction { get; set; } - [JsonProperty("registration-recaptcha-action")] + [JsonPropertyName("registration-recaptcha-action")] public HasOrder RegistrationRecaptchaAction { get; set; } - [JsonProperty("registration-password-action")] + [JsonPropertyName("registration-password-action")] public HasOrder RegistrationPasswordAction { get; set; } - [JsonProperty("registration-user-creation")] + [JsonPropertyName("registration-user-creation")] public HasOrder RegistrationUserCreation { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticator.cs b/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticator.cs index acac2d4c05..ee766a01ba 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticator.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticator.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class FormAuthenticator { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public FormAuthenticatorProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticatorProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticatorProviders.cs index 4a2f6c4277..373ed7f3ff 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticatorProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/FormAuthenticatorProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class FormAuthenticatorProviders { - [JsonProperty("registration-page-form")] + [JsonPropertyName("registration-page-form")] public HasOrder RegistrationPageForm { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/GroupName.cs b/src/keycloak/Keycloak.Library/Models/Root/GroupName.cs index 97a90f8d15..c112df69ce 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/GroupName.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/GroupName.cs @@ -24,14 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using System.Runtime.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(GroupNameConverter))] public enum GroupName { + [EnumMember(Value = "social")] Social, + + [EnumMember(Value = "userdefined")] UserDefined } diff --git a/src/keycloak/Keycloak.Library/Models/Root/HasDefault.cs b/src/keycloak/Keycloak.Library/Models/Root/HasDefault.cs index 7e475417ac..9e9d824eec 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/HasDefault.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/HasDefault.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class HasDefault { - [JsonProperty("default")] + [JsonPropertyName("default")] public HasOrder Default { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/HasOrder.cs b/src/keycloak/Keycloak.Library/Models/Root/HasOrder.cs index 6b15cdaae4..d0b9d04c19 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/HasOrder.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/HasOrder.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class HasOrder { - [JsonProperty("order")] + [JsonPropertyName("order")] public long Order { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Hash.cs b/src/keycloak/Keycloak.Library/Models/Root/Hash.cs index 0a6902f73e..3780dc70bb 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Hash.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Hash.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Hash { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public HashProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/HashProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/HashProviders.cs index 7ff8bf88b0..1dbea3bc14 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/HashProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/HashProviders.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class HashProviders { - [JsonProperty("SHA-384")] + [JsonPropertyName("SHA-384")] public HasOrder Sha384 { get; set; } - [JsonProperty("SHA-256")] + [JsonPropertyName("SHA-256")] public HasOrder Sha256 { get; set; } - [JsonProperty("SHA-512")] + [JsonPropertyName("SHA-512")] public HasOrder Sha512 { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Hostname.cs b/src/keycloak/Keycloak.Library/Models/Root/Hostname.cs index 9e8fcc8ee4..d1ad0b8a99 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Hostname.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Hostname.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Hostname { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public HostnameProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/HostnameProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/HostnameProviders.cs index ca30e765a6..88a30d0eba 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/HostnameProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/HostnameProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class HostnameProviders { - [JsonProperty("request")] + [JsonPropertyName("request")] public HasOrder Request { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/IdentityProvider.cs b/src/keycloak/Keycloak.Library/Models/Root/IdentityProvider.cs index 9b7ed1c81e..50db322db8 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/IdentityProvider.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/IdentityProvider.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class IdentityProvider { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public IdentityProviderProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/IdentityProviderProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/IdentityProviderProviders.cs index 8dd783a8ac..fc0c816f97 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/IdentityProviderProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/IdentityProviderProviders.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class IdentityProviderProviders { - [JsonProperty("saml")] + [JsonPropertyName("saml")] public HasOrder Saml { get; set; } - [JsonProperty("oidc")] + [JsonPropertyName("oidc")] public HasOrder Oidc { get; set; } - [JsonProperty("keycloak-oidc")] + [JsonPropertyName("keycloak-oidc")] public HasOrder KeycloakOidc { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/JsonTypeLabel.cs b/src/keycloak/Keycloak.Library/Models/Root/JsonTypeLabel.cs index c9ee7fb932..88e40cff00 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/JsonTypeLabel.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/JsonTypeLabel.cs @@ -24,23 +24,45 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(JsonTypeLabelConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum JsonTypeLabel { + [EnumMember(Value = "boolean")] Boolean, + + [EnumMember(Value = "clientlist")] ClientList, + + [EnumMember(Value = "file")] File, + + [EnumMember(Value = "list")] List, + + [EnumMember(Value = "multivaluedlist")] MultivaluedList, + + [EnumMember(Value = "multivaluedstring")] MultivaluedString, + + [EnumMember(Value = "password")] Password, + + [EnumMember(Value = "role")] Role, + + [EnumMember(Value = "script")] Script, + + [EnumMember(Value = "string")] String, + + [EnumMember(Value = "text")] Text } diff --git a/src/keycloak/Keycloak.Library/Models/Root/JtaLookup.cs b/src/keycloak/Keycloak.Library/Models/Root/JtaLookup.cs index 86afb16a1c..1b3a2dbb54 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/JtaLookup.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/JtaLookup.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class JtaLookup { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public JtaLookupProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/JtaLookupProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/JtaLookupProviders.cs index 9204792ebc..d505f00e6f 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/JtaLookupProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/JtaLookupProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class JtaLookupProviders { - [JsonProperty("jboss")] + [JsonPropertyName("jboss")] public HasOrder Jboss { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationAuthenticator.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationAuthenticator.cs index 9d11e8e278..772512f2d6 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationAuthenticator.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationAuthenticator.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakAuthenticationAuthenticator { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public List Properties { get; set; } - [JsonProperty("metadata")] + [JsonPropertyName("metadata")] public MetadataClass Metadata { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationFormAction.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationFormAction.cs index 2ddacdf174..e29ed8db3e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationFormAction.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakAuthenticationFormAction.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakAuthenticationFormAction { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public List Properties { get; set; } - [JsonProperty("metadata")] + [JsonPropertyName("metadata")] public MetadataClass Metadata { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapper.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapper.cs index 6f96949308..4fb28c4381 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapper.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapper.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakStorageLdapMappersLdapStorageMapper { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public List Properties { get; set; } - [JsonProperty("metadata")] + [JsonPropertyName("metadata")] public KeycloakStorageLdapMappersLdapStorageMapperMetadata Metadata { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapperMetadata.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapperMetadata.cs index 886a4f0598..7b808965da 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapperMetadata.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageLdapMappersLdapStorageMapperMetadata.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakStorageLdapMappersLdapStorageMapperMetadata { - [JsonProperty("fedToKeycloakSyncSupported")] + [JsonPropertyName("fedToKeycloakSyncSupported")] public bool? FedToKeycloakSyncSupported { get; set; } - [JsonProperty("keycloakToFedSyncSupported")] + [JsonPropertyName("keycloakToFedSyncSupported")] public bool? KeycloakToFedSyncSupported { get; set; } - [JsonProperty("fedToKeycloakSyncMessage")] + [JsonPropertyName("fedToKeycloakSyncMessage")] public string FedToKeycloakSyncMessage { get; set; } - [JsonProperty("keycloakToFedSyncMessage")] + [JsonPropertyName("keycloakToFedSyncMessage")] public string KeycloakToFedSyncMessage { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProvider.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProvider.cs index b66b014b0e..2d331c6e60 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProvider.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProvider.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakStorageUserStorageProvider { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public List Properties { get; set; } - [JsonProperty("metadata")] + [JsonPropertyName("metadata")] public KeycloakStorageUserStorageProviderMetadata Metadata { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProviderMetadata.cs b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProviderMetadata.cs index ed5ee4401b..b8a4264478 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProviderMetadata.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeycloakStorageUserStorageProviderMetadata.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeycloakStorageUserStorageProviderMetadata { - [JsonProperty("synchronizable")] + [JsonPropertyName("synchronizable")] public bool? Synchronizable { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Keys.cs b/src/keycloak/Keycloak.Library/Models/Root/Keys.cs index 541fda60d8..fa1877c48a 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Keys.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Keys.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Keys { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public KeysProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/KeysProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/KeysProviders.cs index c9eb7dfc4a..14c77bf91a 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/KeysProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/KeysProviders.cs @@ -24,27 +24,27 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class KeysProviders { - [JsonProperty("rsa")] + [JsonPropertyName("rsa")] public HasOrder Rsa { get; set; } - [JsonProperty("java-keystore")] + [JsonPropertyName("java-keystore")] public HasOrder JavaKeystore { get; set; } - [JsonProperty("rsa-generated")] + [JsonPropertyName("rsa-generated")] public HasOrder RsaGenerated { get; set; } - [JsonProperty("aes-generated")] + [JsonPropertyName("aes-generated")] public HasOrder AesGenerated { get; set; } - [JsonProperty("ecdsa-generated")] + [JsonPropertyName("ecdsa-generated")] public HasOrder EcdsaGenerated { get; set; } - [JsonProperty("hmac-generated")] + [JsonPropertyName("hmac-generated")] public HasOrder HmacGenerated { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/LdapMapper.cs b/src/keycloak/Keycloak.Library/Models/Root/LdapMapper.cs index a7318de934..21bea862fe 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/LdapMapper.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/LdapMapper.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class LdapMapper { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public LdapMapperProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/LdapMapperProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/LdapMapperProviders.cs index 3ff0f5f270..3208e29fef 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/LdapMapperProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/LdapMapperProviders.cs @@ -24,36 +24,36 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class LdapMapperProviders { - [JsonProperty("msad-lds-user-account-control-mapper")] + [JsonPropertyName("msad-lds-user-account-control-mapper")] public HasOrder MsadLdsUserAccountControlMapper { get; set; } - [JsonProperty("msad-user-account-control-mapper")] + [JsonPropertyName("msad-user-account-control-mapper")] public HasOrder MsadUserAccountControlMapper { get; set; } - [JsonProperty("group-ldap-mapper")] + [JsonPropertyName("group-ldap-mapper")] public HasOrder GroupLdapMapper { get; set; } - [JsonProperty("user-attribute-ldap-mapper")] + [JsonPropertyName("user-attribute-ldap-mapper")] public HasOrder UserAttributeLdapMapper { get; set; } - [JsonProperty("role-ldap-mapper")] + [JsonPropertyName("role-ldap-mapper")] public HasOrder RoleLdapMapper { get; set; } - [JsonProperty("hardcoded-ldap-role-mapper")] + [JsonPropertyName("hardcoded-ldap-role-mapper")] public HasOrder HardcodedLdapRoleMapper { get; set; } - [JsonProperty("full-name-ldap-mapper")] + [JsonPropertyName("full-name-ldap-mapper")] public HasOrder FullNameLdapMapper { get; set; } - [JsonProperty("hardcoded-ldap-attribute-mapper")] + [JsonPropertyName("hardcoded-ldap-attribute-mapper")] public HasOrder HardcodedLdapAttributeMapper { get; set; } - [JsonProperty("hardcoded-ldap-group-mapper")] + [JsonPropertyName("hardcoded-ldap-group-mapper")] public HasOrder HardcodedLdapGroupMapper { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Locale.cs b/src/keycloak/Keycloak.Library/Models/Root/Locale.cs index 3d5361bcc7..f332520d7c 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Locale.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Locale.cs @@ -24,13 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(LocaleConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum Locale { + [EnumMember(Value = "en")] En } diff --git a/src/keycloak/Keycloak.Library/Models/Root/LoginProtocol.cs b/src/keycloak/Keycloak.Library/Models/Root/LoginProtocol.cs index 8dcd9cc382..01cbfa1aea 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/LoginProtocol.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/LoginProtocol.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class LoginProtocol { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public LoginProtocolProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/LoginProtocolProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/LoginProtocolProviders.cs index fd11f92ec7..ca4fb35dd1 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/LoginProtocolProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/LoginProtocolProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class LoginProtocolProviders { - [JsonProperty("saml")] + [JsonPropertyName("saml")] public HasOrder Saml { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public HasOrder OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/MemoryInfo.cs b/src/keycloak/Keycloak.Library/Models/Root/MemoryInfo.cs index 9bdd18642f..304562656f 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/MemoryInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/MemoryInfo.cs @@ -24,30 +24,30 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class MemoryInfo { - [JsonProperty("total")] + [JsonPropertyName("total")] public long Total { get; set; } - [JsonProperty("totalFormated")] + [JsonPropertyName("totalFormated")] public string TotalFormatted { get; set; } - [JsonProperty("used")] + [JsonPropertyName("used")] public long Used { get; set; } - [JsonProperty("usedFormated")] + [JsonPropertyName("usedFormated")] public string UsedFormatted { get; set; } - [JsonProperty("free")] + [JsonPropertyName("free")] public long Free { get; set; } - [JsonProperty("freePercentage")] + [JsonPropertyName("freePercentage")] public long FreePercentage { get; set; } - [JsonProperty("freeFormated")] + [JsonPropertyName("freeFormated")] public string FreeFormatted { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Name.cs b/src/keycloak/Keycloak.Library/Models/Root/Name.cs index 20fb839eaa..1b34f7b8cb 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Name.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Name.cs @@ -24,15 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(NameConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum Name { + [EnumMember(Value = "base")] Base, + + [EnumMember(Value = "keycloak")] Keycloak, + + [EnumMember(Value = "rh-sso")] RhSso } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospection.cs b/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospection.cs index 05d873ee9c..5d7379fb9b 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospection.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospection.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Oauth2TokenIntrospection { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public Oauth2TokenIntrospectionProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospectionProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospectionProviders.cs index d7b6600a68..120a021013 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospectionProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Oauth2TokenIntrospectionProviders.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Oauth2TokenIntrospectionProviders { - [JsonProperty("access_token")] + [JsonPropertyName("access_token")] public HasOrder AccessToken { get; set; } - [JsonProperty("refresh_token")] + [JsonPropertyName("refresh_token")] public HasOrder RefreshToken { get; set; } - [JsonProperty("requesting_party_token")] + [JsonPropertyName("requesting_party_token")] public HasOrder RequestingPartyToken { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnect.cs b/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnect.cs index d7809c1ad3..5fbb6da355 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnect.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnect.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class OpenIdConnect { - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public Protocol Protocol { get; set; } - [JsonProperty("protocolMapper")] + [JsonPropertyName("protocolMapper")] public string ProtocolMapper { get; set; } - [JsonProperty("consentRequired")] + [JsonPropertyName("consentRequired")] public bool? ConsentRequired { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public OpenIdConnectConfig Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnectConfig.cs b/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnectConfig.cs index 47729d4e24..ffe1a824ca 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnectConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/OpenIdConnectConfig.cs @@ -24,51 +24,51 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class OpenIdConnectConfig { - [JsonProperty("userinfo.token.claim")] + [JsonPropertyName("userinfo.token.claim")] public bool? UserInfoTokenClaim { get; set; } - [JsonProperty("user.attribute")] + [JsonPropertyName("user.attribute")] public string UserAttribute { get; set; } - [JsonProperty("id.token.claim")] + [JsonPropertyName("id.token.claim")] public bool? IdTokenClaim { get; set; } - [JsonProperty("access.token.claim")] + [JsonPropertyName("access.token.claim")] public bool? AccessTokenClaim { get; set; } - [JsonProperty("claim.name")] + [JsonPropertyName("claim.name")] public string ClaimName { get; set; } - [JsonProperty("jsonType.label")] + [JsonPropertyName("jsonType.label")] public JsonTypeLabel? JsonTypeLabel { get; set; } - [JsonProperty("user.attribute.formatted")] + [JsonPropertyName("user.attribute.formatted")] public string UserAttributeFormatted { get; set; } - [JsonProperty("user.attribute.country")] + [JsonPropertyName("user.attribute.country")] public string UserAttributeCountry { get; set; } - [JsonProperty("user.attribute.postal_code")] + [JsonPropertyName("user.attribute.postal_code")] public string UserAttributePostalCode { get; set; } - [JsonProperty("user.attribute.street")] + [JsonPropertyName("user.attribute.street")] public string UserAttributeStreet { get; set; } - [JsonProperty("user.attribute.region")] + [JsonPropertyName("user.attribute.region")] public string UserAttributeRegion { get; set; } - [JsonProperty("user.attribute.locality")] + [JsonPropertyName("user.attribute.locality")] public string UserAttributeLocality { get; set; } - [JsonProperty("user.session.note")] + [JsonPropertyName("user.session.note")] public string UserSessionNote { get; set; } - [JsonProperty("multivalued")] + [JsonPropertyName("multivalued")] public bool? Multivalued { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/OperationalInfo.cs b/src/keycloak/Keycloak.Library/Models/Root/OperationalInfo.cs index b129983723..5b99c5c4a2 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/OperationalInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/OperationalInfo.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class OperationalInfo { - [JsonProperty("databaseUrl")] + [JsonPropertyName("databaseUrl")] public string DatabaseUrl { get; set; } - [JsonProperty("databaseUser")] + [JsonPropertyName("databaseUser")] public string DatabaseUser { get; set; } - [JsonProperty("databaseProduct")] + [JsonPropertyName("databaseProduct")] public string DatabaseProduct { get; set; } - [JsonProperty("databaseDriver")] + [JsonPropertyName("databaseDriver")] public string DatabaseDriver { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/PasswordPolicy.cs b/src/keycloak/Keycloak.Library/Models/Root/PasswordPolicy.cs index 616ad6cc84..e5dd2fa080 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/PasswordPolicy.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/PasswordPolicy.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class PasswordPolicy { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("displayName")] + [JsonPropertyName("displayName")] public string DisplayName { get; set; } - [JsonProperty("configType")] + [JsonPropertyName("configType")] public ConfigType? ConfigType { get; set; } - [JsonProperty("defaultValue")] + [JsonPropertyName("defaultValue")] public string DefaultValue { get; set; } - [JsonProperty("multipleSupported")] + [JsonPropertyName("multipleSupported")] public bool? MultipleSupported { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Policy.cs b/src/keycloak/Keycloak.Library/Models/Root/Policy.cs index 487fe50a4b..39308a160c 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Policy.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Policy.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Policy { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public PolicyProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/PolicyProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/PolicyProviders.cs index baa529dddb..40a56f1859 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/PolicyProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/PolicyProviders.cs @@ -24,39 +24,39 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class PolicyProviders { - [JsonProperty("role")] + [JsonPropertyName("role")] public HasOrder Role { get; set; } - [JsonProperty("resource")] + [JsonPropertyName("resource")] public HasOrder Resource { get; set; } - [JsonProperty("scope")] + [JsonPropertyName("scope")] public HasOrder Scope { get; set; } - [JsonProperty("uma")] + [JsonPropertyName("uma")] public HasOrder Uma { get; set; } - [JsonProperty("client")] + [JsonPropertyName("client")] public HasOrder Client { get; set; } - [JsonProperty("js")] + [JsonPropertyName("js")] public HasOrder Js { get; set; } - [JsonProperty("time")] + [JsonPropertyName("time")] public HasOrder Time { get; set; } - [JsonProperty("user")] + [JsonPropertyName("user")] public HasOrder User { get; set; } - [JsonProperty("aggregate")] + [JsonPropertyName("aggregate")] public HasOrder Aggregate { get; set; } - [JsonProperty("group")] + [JsonPropertyName("group")] public HasOrder Group { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Port.cs b/src/keycloak/Keycloak.Library/Models/Root/Port.cs index 75981ff504..78c5e8e2f9 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Port.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Port.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Port { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ExportProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ProfileInfo.cs b/src/keycloak/Keycloak.Library/Models/Root/ProfileInfo.cs index 44b81e2b6c..84c1c18b27 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ProfileInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ProfileInfo.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ProfileInfo { - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("disabledFeatures")] + [JsonPropertyName("disabledFeatures")] public List DisabledFeatures { get; set; } - [JsonProperty("previewFeatures")] + [JsonPropertyName("previewFeatures")] public List PreviewFeatures { get; set; } - [JsonProperty("experimentalFeatures")] + [JsonPropertyName("experimentalFeatures")] public List ExperimentalFeatures { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Protocol.cs b/src/keycloak/Keycloak.Library/Models/Root/Protocol.cs index 922c89df16..ec9ae1d85e 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Protocol.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Protocol.cs @@ -24,15 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; -using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Converters; +using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; -[JsonConverter(typeof(ProtocolConverter))] +[JsonConverter(typeof(EnumMemberConverter))] public enum Protocol { + [EnumMember(Value = "dockerv2")] DockerV2, + + [EnumMember(Value = "openid-connect")] OpenIdConnect, + + [EnumMember(Value = "Saml")] Saml } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperType.cs b/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperType.cs index fb6c8b9e6d..4ca4dfeb56 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperType.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperType.cs @@ -24,28 +24,28 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ProtocolMapperType { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("category")] + [JsonPropertyName("category")] public Category Category { get; set; } - [JsonProperty("helpText")] + [JsonPropertyName("helpText")] public string HelpText { get; set; } - [JsonProperty("priority")] + [JsonPropertyName("priority")] public long Priority { get; set; } - [JsonProperty("properties")] + [JsonPropertyName("properties")] public List Properties { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperTypes.cs b/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperTypes.cs index e5b12bb1a3..c0e813f3af 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperTypes.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ProtocolMapperTypes.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ProtocolMapperTypes { - [JsonProperty("saml")] + [JsonPropertyName("saml")] public List Saml { get; set; } - [JsonProperty("docker-v2")] + [JsonPropertyName("docker-v2")] public List DockerV2 { get; set; } - [JsonProperty("openid-connect")] + [JsonPropertyName("openid-connect")] public List OpenIdConnect { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Provider.cs b/src/keycloak/Keycloak.Library/Models/Root/Provider.cs index 866bcf4739..c8df769638 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Provider.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Provider.cs @@ -24,18 +24,18 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Provider { - [JsonProperty("groupName")] + [JsonPropertyName("groupName")] public GroupName GroupName { get; set; } - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/RequiredAction.cs b/src/keycloak/Keycloak.Library/Models/Root/RequiredAction.cs index ea77ddf1d1..3b47701ffd 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/RequiredAction.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/RequiredAction.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class RequiredAction { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public RequiredActionProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/RequiredActionProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/RequiredActionProviders.cs index 93eefbb6fa..1ea27c3052 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/RequiredActionProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/RequiredActionProviders.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class RequiredActionProviders { - [JsonProperty("terms_and_conditions")] + [JsonPropertyName("terms_and_conditions")] public HasOrder TermsAndConditions { get; set; } - [JsonProperty("CONFIGURE_TOTP")] + [JsonPropertyName("CONFIGURE_TOTP")] public HasOrder ConfigureTotp { get; set; } - [JsonProperty("VERIFY_EMAIL")] + [JsonPropertyName("VERIFY_EMAIL")] public HasOrder VerifyEmail { get; set; } - [JsonProperty("UPDATE_PASSWORD")] + [JsonPropertyName("UPDATE_PASSWORD")] public HasOrder UpdatePassword { get; set; } - [JsonProperty("UPDATE_PROFILE")] + [JsonPropertyName("UPDATE_PROFILE")] public HasOrder UpdateProfile { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Saml.cs b/src/keycloak/Keycloak.Library/Models/Root/Saml.cs index 613b5714e4..1f19f412e8 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Saml.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Saml.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Saml { - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } - [JsonProperty("protocol")] + [JsonPropertyName("protocol")] public Protocol Protocol { get; set; } - [JsonProperty("protocolMapper")] + [JsonPropertyName("protocolMapper")] public string ProtocolMapper { get; set; } - [JsonProperty("consentRequired")] + [JsonPropertyName("consentRequired")] public bool? ConsentRequired { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public SamlConfig Config { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/SamlConfig.cs b/src/keycloak/Keycloak.Library/Models/Root/SamlConfig.cs index e867b23a02..33b222d5ae 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/SamlConfig.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/SamlConfig.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class SamlConfig { - [JsonProperty("attribute.nameformat")] + [JsonPropertyName("attribute.nameformat")] public string AttributeNameformat { get; set; } - [JsonProperty("user.attribute")] + [JsonPropertyName("user.attribute")] public string UserAttribute { get; set; } - [JsonProperty("friendly.name")] + [JsonPropertyName("friendly.name")] public string FriendlyName { get; set; } - [JsonProperty("attribute.name")] + [JsonPropertyName("attribute.name")] public string AttributeName { get; set; } - [JsonProperty("single")] + [JsonPropertyName("single")] public bool? Single { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Scripting.cs b/src/keycloak/Keycloak.Library/Models/Root/Scripting.cs index dde02386a0..c8a1cd443c 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Scripting.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Scripting.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Scripting { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ScriptingProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ScriptingProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ScriptingProviders.cs index f7e5d647a5..a941ce7465 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ScriptingProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ScriptingProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ScriptingProviders { - [JsonProperty("script-based-auth")] + [JsonPropertyName("script-based-auth")] public HasOrder ScriptBasedAuth { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ServerInfo.cs b/src/keycloak/Keycloak.Library/Models/Root/ServerInfo.cs index 921c150c93..308fdea083 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ServerInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ServerInfo.cs @@ -24,48 +24,48 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ServerInfo { - [JsonProperty("systemInfo")] + [JsonPropertyName("systemInfo")] public SystemInfo SystemInfo { get; set; } - [JsonProperty("memoryInfo")] + [JsonPropertyName("memoryInfo")] public MemoryInfo MemoryInfo { get; set; } - [JsonProperty("profileInfo")] + [JsonPropertyName("profileInfo")] public ProfileInfo ProfileInfo { get; set; } - [JsonProperty("themes")] + [JsonPropertyName("themes")] public Themes Themes { get; set; } - [JsonProperty("socialProviders")] + [JsonPropertyName("socialProviders")] public List SocialProviders { get; set; } - [JsonProperty("identityProviders")] + [JsonPropertyName("identityProviders")] public List IdentityProviders { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ServerInfoProviders Providers { get; set; } - [JsonProperty("protocolMapperTypes")] + [JsonPropertyName("protocolMapperTypes")] public ProtocolMapperTypes ProtocolMapperTypes { get; set; } - [JsonProperty("builtinProtocolMappers")] + [JsonPropertyName("builtinProtocolMappers")] public BuiltinProtocolMappers BuiltinProtocolMappers { get; set; } - [JsonProperty("clientInstallations")] + [JsonPropertyName("clientInstallations")] public ClientInstallations ClientInstallations { get; set; } - [JsonProperty("componentTypes")] + [JsonPropertyName("componentTypes")] public ComponentTypes ComponentTypes { get; set; } - [JsonProperty("passwordPolicies")] + [JsonPropertyName("passwordPolicies")] public List PasswordPolicies { get; set; } - [JsonProperty("enums")] + [JsonPropertyName("enums")] public Enums Enums { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ServerInfoProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ServerInfoProviders.cs index 0d37180c5f..133f086ff6 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ServerInfoProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ServerInfoProviders.cs @@ -24,240 +24,240 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ServerInfoProviders { - [JsonProperty("account")] + [JsonPropertyName("account")] public EmailTemplateClass Account { get; set; } - [JsonProperty("actionToken")] + [JsonPropertyName("actionToken")] public ActionToken ActionToken { get; set; } - [JsonProperty("actionTokenHandler")] + [JsonPropertyName("actionTokenHandler")] public ActionTokenHandler ActionTokenHandler { get; set; } - [JsonProperty("authenticationSessions")] + [JsonPropertyName("authenticationSessions")] public ActionToken AuthenticationSessions { get; set; } - [JsonProperty("authenticator")] + [JsonPropertyName("authenticator")] public Authenticator Authenticator { get; set; } - [JsonProperty("authorization")] + [JsonPropertyName("authorization")] public Authorization Authorization { get; set; } - [JsonProperty("authorizationCache")] + [JsonPropertyName("authorizationCache")] public AuthorizationCache AuthorizationCache { get; set; } - [JsonProperty("authorizationPersister")] + [JsonPropertyName("authorizationPersister")] public AuthorizationPersister AuthorizationPersister { get; set; } - [JsonProperty("bruteForceProtector")] + [JsonPropertyName("bruteForceProtector")] public BruteForceProtector BruteForceProtector { get; set; } - [JsonProperty("client-authenticator")] + [JsonPropertyName("client-authenticator")] public ClientAuthenticator ClientAuthenticator { get; set; } - [JsonProperty("client-description-converter")] + [JsonPropertyName("client-description-converter")] public ClientDescriptionConverter ClientDescriptionConverter { get; set; } - [JsonProperty("client-installation")] + [JsonPropertyName("client-installation")] public Authenticator ClientInstallation { get; set; } - [JsonProperty("client-registration")] + [JsonPropertyName("client-registration")] public ClientRegistration ClientRegistration { get; set; } - [JsonProperty("client-registration-policy")] + [JsonPropertyName("client-registration-policy")] public ClientRegistrationPolicy ClientRegistrationPolicy { get; set; } - [JsonProperty("client-storage")] + [JsonPropertyName("client-storage")] public ClientStorage ClientStorage { get; set; } - [JsonProperty("clientSignature")] + [JsonPropertyName("clientSignature")] public Authenticator ClientSignature { get; set; } - [JsonProperty("cluster")] + [JsonPropertyName("cluster")] public ActionToken Cluster { get; set; } - [JsonProperty("codeToTokenStore")] + [JsonPropertyName("codeToTokenStore")] public ActionToken CodeToTokenStore { get; set; } - [JsonProperty("connectionsHttpClient")] + [JsonPropertyName("connectionsHttpClient")] public AuthorizationCache ConnectionsHttpClient { get; set; } - [JsonProperty("connectionsInfinispan")] + [JsonPropertyName("connectionsInfinispan")] public AuthorizationCache ConnectionsInfinispan { get; set; } - [JsonProperty("connectionsJpa")] + [JsonPropertyName("connectionsJpa")] public ConnectionsJpa ConnectionsJpa { get; set; } - [JsonProperty("connectionsJpaUpdater")] + [JsonPropertyName("connectionsJpaUpdater")] public ConnectionsJpaUpdater ConnectionsJpaUpdater { get; set; } - [JsonProperty("connectionsLiquibase")] + [JsonPropertyName("connectionsLiquibase")] public AuthorizationCache ConnectionsLiquibase { get; set; } - [JsonProperty("credential")] + [JsonPropertyName("credential")] public Credential Credential { get; set; } - [JsonProperty("dblock")] + [JsonPropertyName("dblock")] public AuthorizationPersister Dblock { get; set; } - [JsonProperty("emailSender")] + [JsonPropertyName("emailSender")] public AuthorizationCache EmailSender { get; set; } - [JsonProperty("emailTemplate")] + [JsonPropertyName("emailTemplate")] public EmailTemplateClass EmailTemplate { get; set; } - [JsonProperty("eventsListener")] + [JsonPropertyName("eventsListener")] public EventsListener EventsListener { get; set; } - [JsonProperty("eventsStore")] + [JsonPropertyName("eventsStore")] public AuthorizationPersister EventsStore { get; set; } - [JsonProperty("exception-converter")] + [JsonPropertyName("exception-converter")] public AuthorizationPersister ExceptionConverter { get; set; } - [JsonProperty("executors")] + [JsonPropertyName("executors")] public AuthorizationCache Executors { get; set; } - [JsonProperty("export")] + [JsonPropertyName("export")] public Port Export { get; set; } - [JsonProperty("form-action")] + [JsonPropertyName("form-action")] public FormAction FormAction { get; set; } - [JsonProperty("form-authenticator")] + [JsonPropertyName("form-authenticator")] public FormAuthenticator FormAuthenticator { get; set; } - [JsonProperty("hash")] + [JsonPropertyName("hash")] public Hash Hash { get; set; } - [JsonProperty("hostname")] + [JsonPropertyName("hostname")] public Hostname Hostname { get; set; } - [JsonProperty("identity-provider-mapper")] + [JsonPropertyName("identity-provider-mapper")] public Authenticator IdentityProviderMapper { get; set; } - [JsonProperty("identity_provider")] + [JsonPropertyName("identity_provider")] public IdentityProvider IdentityProvider { get; set; } - [JsonProperty("import")] + [JsonPropertyName("import")] public Port Import { get; set; } - [JsonProperty("jpa-entity-provider")] + [JsonPropertyName("jpa-entity-provider")] public ClientStorage JpaEntityProvider { get; set; } - [JsonProperty("jta-lookup")] + [JsonPropertyName("jta-lookup")] public JtaLookup JtaLookup { get; set; } - [JsonProperty("keys")] + [JsonPropertyName("keys")] public Keys Keys { get; set; } - [JsonProperty("ldap-mapper")] + [JsonPropertyName("ldap-mapper")] public LdapMapper LdapMapper { get; set; } - [JsonProperty("localeSelector")] + [JsonPropertyName("localeSelector")] public AuthorizationCache LocaleSelector { get; set; } - [JsonProperty("login")] + [JsonPropertyName("login")] public EmailTemplateClass Login { get; set; } - [JsonProperty("login-protocol")] + [JsonPropertyName("login-protocol")] public LoginProtocol LoginProtocol { get; set; } - [JsonProperty("migration")] + [JsonPropertyName("migration")] public AuthorizationCache Migration { get; set; } - [JsonProperty("oauth2-token-introspection")] + [JsonPropertyName("oauth2-token-introspection")] public Oauth2TokenIntrospection Oauth2TokenIntrospection { get; set; } - [JsonProperty("openid-connect-ext")] + [JsonPropertyName("openid-connect-ext")] public ClientStorage OpenIdConnectExt { get; set; } - [JsonProperty("password-hashing")] + [JsonPropertyName("password-hashing")] public Authenticator PasswordHashing { get; set; } - [JsonProperty("password-policy")] + [JsonPropertyName("password-policy")] public Authenticator PasswordPolicy { get; set; } - [JsonProperty("password-policy-manager")] + [JsonPropertyName("password-policy-manager")] public AuthorizationCache PasswordPolicyManager { get; set; } - [JsonProperty("policy")] + [JsonPropertyName("policy")] public Policy Policy { get; set; } - [JsonProperty("protocol-mapper")] + [JsonPropertyName("protocol-mapper")] public Authenticator ProtocolMapper { get; set; } - [JsonProperty("publicKeyStorage")] + [JsonPropertyName("publicKeyStorage")] public ActionToken PublicKeyStorage { get; set; } - [JsonProperty("realm")] + [JsonPropertyName("realm")] public AuthorizationPersister Realm { get; set; } - [JsonProperty("realm-restapi-extension")] + [JsonPropertyName("realm-restapi-extension")] public ClientStorage RealmRestapiExtension { get; set; } - [JsonProperty("realmCache")] + [JsonPropertyName("realmCache")] public AuthorizationCache RealmCache { get; set; } - [JsonProperty("required-action")] + [JsonPropertyName("required-action")] public RequiredAction RequiredAction { get; set; } - [JsonProperty("scripting")] + [JsonPropertyName("scripting")] public Scripting Scripting { get; set; } - [JsonProperty("signature")] + [JsonPropertyName("signature")] public Authenticator Signature { get; set; } - [JsonProperty("singleUseTokenStore")] + [JsonPropertyName("singleUseTokenStore")] public ActionToken SingleUseTokenStore { get; set; } - [JsonProperty("social")] + [JsonPropertyName("social")] public Authenticator Social { get; set; } - [JsonProperty("stickySessionEncoder")] + [JsonPropertyName("stickySessionEncoder")] public ActionToken StickySessionEncoder { get; set; } - [JsonProperty("storage")] + [JsonPropertyName("storage")] public Storage Storage { get; set; } - [JsonProperty("theme")] + [JsonPropertyName("theme")] public Theme Theme { get; set; } - [JsonProperty("themeResource")] + [JsonPropertyName("themeResource")] public ClientStorage ThemeResource { get; set; } - [JsonProperty("themeSelector")] + [JsonPropertyName("themeSelector")] public AuthorizationCache ThemeSelector { get; set; } - [JsonProperty("timer")] + [JsonPropertyName("timer")] public Timer Timer { get; set; } - [JsonProperty("truststore")] + [JsonPropertyName("truststore")] public Truststore Truststore { get; set; } - [JsonProperty("user")] + [JsonPropertyName("user")] public AuthorizationPersister User { get; set; } - [JsonProperty("userCache")] + [JsonPropertyName("userCache")] public AuthorizationCache UserCache { get; set; } - [JsonProperty("userFederatedStorage")] + [JsonPropertyName("userFederatedStorage")] public AuthorizationPersister UserFederatedStorage { get; set; } - [JsonProperty("userSessionPersister")] + [JsonPropertyName("userSessionPersister")] public AuthorizationPersister UserSessionPersister { get; set; } - [JsonProperty("userSessions")] + [JsonPropertyName("userSessions")] public ActionToken UserSessions { get; set; } - [JsonProperty("well-known")] + [JsonPropertyName("well-known")] public WellKnown WellKnown { get; set; } - [JsonProperty("x509cert-lookup")] + [JsonPropertyName("x509cert-lookup")] public AuthorizationCache X509CertLookup { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Storage.cs b/src/keycloak/Keycloak.Library/Models/Root/Storage.cs index 6c96fc5d77..a4f69012d4 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Storage.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Storage.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Storage { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public StorageProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/StorageProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/StorageProviders.cs index bde277c8c0..8bc028cf2c 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/StorageProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/StorageProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class StorageProviders { - [JsonProperty("ldap")] + [JsonPropertyName("ldap")] public HasOrder Ldap { get; set; } - [JsonProperty("kerberos")] + [JsonPropertyName("kerberos")] public HasOrder Kerberos { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/SystemInfo.cs b/src/keycloak/Keycloak.Library/Models/Root/SystemInfo.cs index d90068f60f..f24b8c5b3a 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/SystemInfo.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/SystemInfo.cs @@ -24,63 +24,63 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class SystemInfo { - [JsonProperty("version")] + [JsonPropertyName("version")] public string Version { get; set; } - [JsonProperty("serverTime")] + [JsonPropertyName("serverTime")] public string ServerTime { get; set; } - [JsonProperty("uptime")] + [JsonPropertyName("uptime")] public string Uptime { get; set; } - [JsonProperty("uptimeMillis")] + [JsonPropertyName("uptimeMillis")] public long UptimeMillis { get; set; } - [JsonProperty("javaVersion")] + [JsonPropertyName("javaVersion")] public string JavaVersion { get; set; } - [JsonProperty("javaVendor")] + [JsonPropertyName("javaVendor")] public string JavaVendor { get; set; } - [JsonProperty("javaVm")] + [JsonPropertyName("javaVm")] public string JavaVm { get; set; } - [JsonProperty("javaVmVersion")] + [JsonPropertyName("javaVmVersion")] public string JavaVmVersion { get; set; } - [JsonProperty("javaRuntime")] + [JsonPropertyName("javaRuntime")] public string JavaRuntime { get; set; } - [JsonProperty("javaHome")] + [JsonPropertyName("javaHome")] public string JavaHome { get; set; } - [JsonProperty("osName")] + [JsonPropertyName("osName")] public string OsName { get; set; } - [JsonProperty("osArchitecture")] + [JsonPropertyName("osArchitecture")] public string OsArchitecture { get; set; } - [JsonProperty("osVersion")] + [JsonPropertyName("osVersion")] public string OsVersion { get; set; } - [JsonProperty("fileEncoding")] + [JsonPropertyName("fileEncoding")] public string FileEncoding { get; set; } - [JsonProperty("userName")] + [JsonPropertyName("userName")] public string UserName { get; set; } - [JsonProperty("userDir")] + [JsonPropertyName("userDir")] public string UserDir { get; set; } - [JsonProperty("userTimezone")] + [JsonPropertyName("userTimezone")] public string UserTimezone { get; set; } - [JsonProperty("userLocale")] + [JsonPropertyName("userLocale")] public string UserLocale { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Theme.cs b/src/keycloak/Keycloak.Library/Models/Root/Theme.cs index 5eea9222ee..d67685b5fa 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Theme.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Theme.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Theme { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public ThemeProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/ThemeProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/ThemeProviders.cs index 09769cd623..b13b3c5924 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/ThemeProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/ThemeProviders.cs @@ -24,21 +24,21 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class ThemeProviders { - [JsonProperty("folder")] + [JsonPropertyName("folder")] public HasOrder Folder { get; set; } - [JsonProperty("module")] + [JsonPropertyName("module")] public HasOrder Module { get; set; } - [JsonProperty("jar")] + [JsonPropertyName("jar")] public HasOrder Jar { get; set; } - [JsonProperty("extending")] + [JsonPropertyName("extending")] public HasOrder Extending { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Themes.cs b/src/keycloak/Keycloak.Library/Models/Root/Themes.cs index e35460e4c2..16f9d16303 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Themes.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Themes.cs @@ -24,27 +24,27 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Themes { - [JsonProperty("common")] + [JsonPropertyName("common")] public List Common { get; set; } - [JsonProperty("admin")] + [JsonPropertyName("admin")] public List Admin { get; set; } - [JsonProperty("login")] + [JsonPropertyName("login")] public List Login { get; set; } - [JsonProperty("welcome")] + [JsonPropertyName("welcome")] public List Welcome { get; set; } - [JsonProperty("account")] + [JsonPropertyName("account")] public List Account { get; set; } - [JsonProperty("email")] + [JsonPropertyName("email")] public List Email { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Timer.cs b/src/keycloak/Keycloak.Library/Models/Root/Timer.cs index b55adf849b..137077556f 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Timer.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Timer.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Timer { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public TimerProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/TimerProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/TimerProviders.cs index c7bed28ab1..5953081898 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/TimerProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/TimerProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class TimerProviders { - [JsonProperty("basic")] + [JsonPropertyName("basic")] public HasOrder Basic { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/Truststore.cs b/src/keycloak/Keycloak.Library/Models/Root/Truststore.cs index 14518698b3..683cef17c3 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/Truststore.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/Truststore.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class Truststore { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public TruststoreProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/TruststoreProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/TruststoreProviders.cs index 892671f268..a708eeba63 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/TruststoreProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/TruststoreProviders.cs @@ -24,12 +24,12 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class TruststoreProviders { - [JsonProperty("file")] + [JsonPropertyName("file")] public HasOrder File { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/WellKnown.cs b/src/keycloak/Keycloak.Library/Models/Root/WellKnown.cs index bf82b4a554..5cd9b79284 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/WellKnown.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/WellKnown.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class WellKnown { - [JsonProperty("internal")] + [JsonPropertyName("internal")] public bool? Internal { get; set; } - [JsonProperty("providers")] + [JsonPropertyName("providers")] public WellKnownProviders Providers { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Root/WellKnownProviders.cs b/src/keycloak/Keycloak.Library/Models/Root/WellKnownProviders.cs index d371de766d..0531bf2ec4 100644 --- a/src/keycloak/Keycloak.Library/Models/Root/WellKnownProviders.cs +++ b/src/keycloak/Keycloak.Library/Models/Root/WellKnownProviders.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Root; public class WellKnownProviders { - [JsonProperty("openid-configuration")] + [JsonPropertyName("openid-configuration")] public HasOrder OpenIdConfiguration { get; set; } - [JsonProperty("uma2-configuration")] + [JsonPropertyName("uma2-configuration")] public HasOrder Uma2Configuration { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/UserStorageProvider/SynchronizationResult.cs b/src/keycloak/Keycloak.Library/Models/UserStorageProvider/SynchronizationResult.cs index 3d34440ef8..3bdfab109a 100644 --- a/src/keycloak/Keycloak.Library/Models/UserStorageProvider/SynchronizationResult.cs +++ b/src/keycloak/Keycloak.Library/Models/UserStorageProvider/SynchronizationResult.cs @@ -24,22 +24,22 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.UserStorageProvider; public class SynchronizationResult { - [JsonProperty("added")] + [JsonPropertyName("added")] public int? Added { get; set; } - [JsonProperty("failed")] + [JsonPropertyName("failed")] public int? Failed { get; set; } - [JsonProperty("ignored")] + [JsonPropertyName("ignored")] public bool? Ignored { get; set; } - [JsonProperty("removed")] + [JsonPropertyName("removed")] public int? Removed { get; set; } - [JsonProperty("status")] + [JsonPropertyName("status")] public string Status { get; set; } - [JsonProperty("updated")] + [JsonPropertyName("updated")] public int? Updated { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/Credentials.cs b/src/keycloak/Keycloak.Library/Models/Users/Credentials.cs index 995bf5b58d..57c1abc238 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/Credentials.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/Credentials.cs @@ -24,36 +24,36 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class Credentials { - [JsonProperty("algorithm")] + [JsonPropertyName("algorithm")] public string? Algorithm { get; set; } - [JsonProperty("config")] + [JsonPropertyName("config")] public IDictionary? Config { get; set; } - [JsonProperty("counter")] + [JsonPropertyName("counter")] public int? Counter { get; set; } - [JsonProperty("createdDate")] + [JsonPropertyName("createdDate")] public long? CreatedDate { get; set; } - [JsonProperty("device")] + [JsonPropertyName("device")] public string? Device { get; set; } - [JsonProperty("digits")] + [JsonPropertyName("digits")] public int? Digits { get; set; } - [JsonProperty("hashIterations")] + [JsonPropertyName("hashIterations")] public int? HashIterations { get; set; } - [JsonProperty("hashSaltedValue")] + [JsonPropertyName("hashSaltedValue")] public string? HashSaltedValue { get; set; } - [JsonProperty("period")] + [JsonPropertyName("period")] public int? Period { get; set; } - [JsonProperty("salt")] + [JsonPropertyName("salt")] public string? Salt { get; set; } - [JsonProperty("temporary")] + [JsonPropertyName("temporary")] public bool? Temporary { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string? Type { get; set; } - [JsonProperty("value")] + [JsonPropertyName("value")] public string? Value { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/FederatedIdentity.cs b/src/keycloak/Keycloak.Library/Models/Users/FederatedIdentity.cs index 6fb5169a94..2215491cd1 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/FederatedIdentity.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/FederatedIdentity.cs @@ -24,16 +24,16 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class FederatedIdentity { - [JsonProperty("identityProvider")] + [JsonPropertyName("identityProvider")] public string? IdentityProvider { get; set; } = default!; - [JsonProperty("userId")] + [JsonPropertyName("userId")] public string? UserId { get; set; } = default!; - [JsonProperty("userName")] + [JsonPropertyName("userName")] public string? UserName { get; set; } = default!; } diff --git a/src/keycloak/Keycloak.Library/Models/Users/SetPasswordResponse.cs b/src/keycloak/Keycloak.Library/Models/Users/SetPasswordResponse.cs index 93521ad2a2..18bf587392 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/SetPasswordResponse.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/SetPasswordResponse.cs @@ -24,15 +24,15 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class SetPasswordResponse { public bool Success { get; set; } - [JsonProperty("error")] + [JsonPropertyName("error")] public string Error { get; set; } - [JsonProperty("error_description")] + [JsonPropertyName("error_description")] public string ErrorDescription { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/User.cs b/src/keycloak/Keycloak.Library/Models/Users/User.cs index 566dd9f491..26729a7dcc 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/User.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/User.cs @@ -24,58 +24,58 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class User { - [JsonProperty("id")] + [JsonPropertyName("id")] public string? Id { get; set; } - [JsonProperty("createdTimestamp")] + [JsonPropertyName("createdTimestamp")] public long? CreatedTimestamp { get; set; } - [JsonProperty("username")] + [JsonPropertyName("username")] public string? UserName { get; set; } = default!; - [JsonProperty("enabled")] + [JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonProperty("totp")] + [JsonPropertyName("totp")] public bool? Totp { get; set; } - [JsonProperty("emailVerified")] + [JsonPropertyName("emailVerified")] public bool? EmailVerified { get; set; } - [JsonProperty("firstName")] + [JsonPropertyName("firstName")] public string? FirstName { get; set; } - [JsonProperty("lastName")] + [JsonPropertyName("lastName")] public string? LastName { get; set; } - [JsonProperty("email")] + [JsonPropertyName("email")] public string? Email { get; set; } - [JsonProperty("disableableCredentialTypes")] + [JsonPropertyName("disableableCredentialTypes")] public IEnumerable? DisableableCredentialTypes { get; set; } - [JsonProperty("requiredActions")] + [JsonPropertyName("requiredActions")] public IEnumerable? RequiredActions { get; set; } - [JsonProperty("notBefore")] + [JsonPropertyName("notBefore")] public int? NotBefore { get; set; } - [JsonProperty("access")] + [JsonPropertyName("access")] public UserAccess? Access { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public IDictionary>? Attributes { get; set; } - [JsonProperty("clientConsents")] + [JsonPropertyName("clientConsents")] public IEnumerable? ClientConsents { get; set; } - [JsonProperty("clientRoles")] + [JsonPropertyName("clientRoles")] public IDictionary>? ClientRoles { get; set; } - [JsonProperty("credentials")] + [JsonPropertyName("credentials")] public IEnumerable? Credentials { get; set; } - [JsonProperty("federatedIdentities")] + [JsonPropertyName("federatedIdentities")] public IEnumerable? FederatedIdentities { get; set; } - [JsonProperty("federationLink")] + [JsonPropertyName("federationLink")] public string? FederationLink { get; set; } - [JsonProperty("groups")] + [JsonPropertyName("groups")] public IEnumerable? Groups { get; set; } - [JsonProperty("origin")] + [JsonPropertyName("origin")] public string? Origin { get; set; } - [JsonProperty("realmRoles")] + [JsonPropertyName("realmRoles")] public IEnumerable? RealmRoles { get; set; } - [JsonProperty("self")] + [JsonPropertyName("self")] public string? Self { get; set; } - [JsonProperty("serviceAccountClientId")] + [JsonPropertyName("serviceAccountClientId")] public string? ServiceAccountClientId { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/UserAccess.cs b/src/keycloak/Keycloak.Library/Models/Users/UserAccess.cs index e31c01a1d0..252cb6d6c1 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/UserAccess.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/UserAccess.cs @@ -24,20 +24,20 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class UserAccess { - [JsonProperty("manageGroupMembership")] + [JsonPropertyName("manageGroupMembership")] public bool? ManageGroupMembership { get; set; } - [JsonProperty("view")] + [JsonPropertyName("view")] public bool? View { get; set; } - [JsonProperty("mapRoles")] + [JsonPropertyName("mapRoles")] public bool? MapRoles { get; set; } - [JsonProperty("impersonate")] + [JsonPropertyName("impersonate")] public bool? Impersonate { get; set; } - [JsonProperty("manage")] + [JsonPropertyName("manage")] public bool? Manage { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/UserConsent.cs b/src/keycloak/Keycloak.Library/Models/Users/UserConsent.cs index e643238ca6..ef82f56e70 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/UserConsent.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/UserConsent.cs @@ -24,20 +24,20 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class UserConsent { - [JsonProperty("clientId")] + [JsonPropertyName("clientId")] public string? ClientId { get; set; } - [JsonProperty("grantedClientScopes")] + [JsonPropertyName("grantedClientScopes")] public IEnumerable? GrantedClientScopes { get; set; } - [JsonProperty("createdDate")] + [JsonPropertyName("createdDate")] public long? CreatedDate { get; set; } - [JsonProperty("lastUpdatedDate")] + [JsonPropertyName("lastUpdatedDate")] public long? LastUpdatedDate { get; set; } - [JsonProperty("additionalGrants")] + [JsonPropertyName("additionalGrants")] public IEnumerable? AdditionalGrants { get; set; } } diff --git a/src/keycloak/Keycloak.Library/Models/Users/UserSession.cs b/src/keycloak/Keycloak.Library/Models/Users/UserSession.cs index afbf335e80..9d57d8b9f4 100644 --- a/src/keycloak/Keycloak.Library/Models/Users/UserSession.cs +++ b/src/keycloak/Keycloak.Library/Models/Users/UserSession.cs @@ -24,24 +24,24 @@ * SOFTWARE. ********************************************************************************/ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; public class UserSession { - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } - [JsonProperty("username")] + [JsonPropertyName("username")] public string UserName { get; set; } - [JsonProperty("userId")] + [JsonPropertyName("userId")] public string UserId { get; set; } - [JsonProperty("ipAddress")] + [JsonPropertyName("ipAddress")] public string IpAddress { get; set; } - [JsonProperty("start")] + [JsonPropertyName("start")] public long Start { get; set; } - [JsonProperty("lastAccess")] + [JsonPropertyName("lastAccess")] public long LastAccess { get; set; } - [JsonProperty("clients")] + [JsonPropertyName("clients")] public IDictionary Clients { get; set; } } diff --git a/src/keycloak/Keycloak.Library/ProtocolMappers/KeycloakClient.cs b/src/keycloak/Keycloak.Library/ProtocolMappers/KeycloakClient.cs index 8c9948081f..5dbb23c544 100644 --- a/src/keycloak/Keycloak.Library/ProtocolMappers/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/ProtocolMappers/KeycloakClient.cs @@ -47,7 +47,7 @@ public async Task CreateProtocolMapperAsync(string realm, string clientScopeId, .AppendPathSegment("/client-scopes/") .AppendPathSegment(clientScopeId, true) .AppendPathSegment("/protocol-mappers/models") - .PostJsonAsync(protocolMapperRepresentation, cancellationToken) + .PostJsonAsync(protocolMapperRepresentation, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetProtocolMappersAsync(string realm, string clientScopeId) => @@ -79,7 +79,7 @@ public async Task UpdateProtocolMapperAsync(string realm, string clientScopeId, .AppendPathSegment(clientScopeId, true) .AppendPathSegment("/protocol-mappers/models/") .AppendPathSegment(protocolMapperId, true) - .PutJsonAsync(protocolMapperRepresentation, cancellationToken) + .PutJsonAsync(protocolMapperRepresentation, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteProtocolMapperAsync(string realm, string clientScopeId, string protocolMapperId, CancellationToken cancellationToken = default) => @@ -90,7 +90,7 @@ public async Task DeleteProtocolMapperAsync(string realm, string clientScopeId, .AppendPathSegment(clientScopeId, true) .AppendPathSegment("/protocol-mappers/models/") .AppendPathSegment(protocolMapperId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetProtocolMappersByNameAsync(string realm, string clientScopeId, string protocol) => @@ -111,7 +111,7 @@ public async Task CreateClientProtocolMapperAsync(string realm, string clientId, .AppendPathSegment("/clients/") .AppendPathSegment(clientId, true) .AppendPathSegment("/protocol-mappers/models") - .PostJsonAsync(protocolMapperRepresentation, cancellationToken) + .PostJsonAsync(protocolMapperRepresentation, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateClientProtocolMapperAsync(string realm, string clientId, string protocolMapperId, ProtocolMapper protocolMapperRepresentation, CancellationToken cancellationToken = default) => @@ -122,7 +122,7 @@ public async Task UpdateClientProtocolMapperAsync(string realm, string clientId, .AppendPathSegment(clientId, true) .AppendPathSegment("/protocol-mappers/models/") .AppendPathSegment(protocolMapperId, true) - .PutJsonAsync(protocolMapperRepresentation, cancellationToken) + .PutJsonAsync(protocolMapperRepresentation, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteClientProtocolMapperAsync(string realm, string clientId, string protocolMapperId, CancellationToken cancellationToken = default) => @@ -133,6 +133,6 @@ public async Task DeleteClientProtocolMapperAsync(string realm, string clientId, .AppendPathSegment(clientId, true) .AppendPathSegment("/protocol-mappers/models/") .AppendPathSegment(protocolMapperId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } diff --git a/src/keycloak/Keycloak.Library/RealmsAdmin/KeycloakClient.cs b/src/keycloak/Keycloak.Library/RealmsAdmin/KeycloakClient.cs index 7dba5e88a7..286ed0f9c5 100644 --- a/src/keycloak/Keycloak.Library/RealmsAdmin/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/RealmsAdmin/KeycloakClient.cs @@ -37,7 +37,7 @@ public partial class KeycloakClient public async Task ImportRealmAsync(string realm, Realm rep, CancellationToken cancellationToken = default) => await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms") - .PostJsonAsync(rep, cancellationToken) + .PostJsonAsync(rep, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetRealmsAsync(string realm) => @@ -50,14 +50,14 @@ public async Task GetRealmAsync(string realm, CancellationToken cancellat await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) - .GetJsonAsync(cancellationToken) + .GetJsonAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateRealmAsync(string realm, Realm rep, CancellationToken cancellationToken = default) => await (await GetBaseUrlAsync(realm, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) - .PutJsonAsync(rep, cancellationToken) + .PutJsonAsync(rep, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteRealmAsync(string realm) => @@ -336,7 +336,7 @@ public async Task RealmPartialImportAsync(string realm, P .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/partialImport") - .PostJsonAsync(rep, cancellationToken) + .PostJsonAsync(rep, cancellationToken: cancellationToken) .ReceiveJson() .ConfigureAwait(ConfigureAwaitOptions.None); diff --git a/src/keycloak/Keycloak.Library/RoleMapper/KeycloakClient.cs b/src/keycloak/Keycloak.Library/RoleMapper/KeycloakClient.cs index aae5325446..c2a9c08c98 100644 --- a/src/keycloak/Keycloak.Library/RoleMapper/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/RoleMapper/KeycloakClient.cs @@ -108,7 +108,7 @@ public async Task AddRealmRoleMappingsToUserAsync(string realm, string userId, I .AppendPathSegment("/users/") .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/realm") - .PostJsonAsync(roles, cancellationToken) + .PostJsonAsync(roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetRealmRoleMappingsForUserAsync(string realm, string userId, CancellationToken cancellationToken = default) => @@ -118,7 +118,7 @@ public async Task> GetRealmRoleMappingsForUserAsync(string rea .AppendPathSegment("/users/") .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/realm") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteRealmRoleMappingsFromUserAsync(string realm, string userId, IEnumerable roles, CancellationToken cancellationToken = default) => @@ -128,7 +128,7 @@ public async Task DeleteRealmRoleMappingsFromUserAsync(string realm, string user .AppendPathSegment("/users/") .AppendPathSegment(userId, true) .AppendPathSegment("/role-mappings/realm") - .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken) + .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetAvailableRealmRoleMappingsForUserAsync(string realm, string userId) => diff --git a/src/keycloak/Keycloak.Library/Roles/KeycloakClient.cs b/src/keycloak/Keycloak.Library/Roles/KeycloakClient.cs index 7fbe0dc8e9..62f4773641 100644 --- a/src/keycloak/Keycloak.Library/Roles/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/Roles/KeycloakClient.cs @@ -40,7 +40,7 @@ public async Task CreateRoleAsync(string realm, string clientId, Role role, Canc .AppendPathSegment("/clients/") .AppendPathSegment(clientId, true) .AppendPathSegment("/roles") - .PostJsonAsync(role, cancellationToken) + .PostJsonAsync(role, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task CreateRoleAsync(string realm, Role role, CancellationToken cancellationToken = default) => @@ -48,7 +48,7 @@ public async Task CreateRoleAsync(string realm, Role role, CancellationToken can .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/roles") - .PostJsonAsync(role, cancellationToken) + .PostJsonAsync(role, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetRolesAsync(string realm, string clientId, int? first = null, int? max = null, string? search = null, CancellationToken cancellationToken = default) @@ -67,7 +67,7 @@ public async Task> GetRolesAsync(string realm, string clientId .AppendPathSegment(clientId, true) .AppendPathSegment("/roles") .SetQueryParams(queryParams) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } @@ -85,7 +85,7 @@ public async Task> GetRolesAsync(string realm, int? first = nu .AppendPathSegment(realm, true) .AppendPathSegment("/roles") .SetQueryParams(queryParams) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } @@ -97,7 +97,7 @@ public async Task GetRoleByNameAsync(string realm, string clientId, string .AppendPathSegment(clientId, true) .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) - .GetJsonAsync(cancellationToken) + .GetJsonAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task GetRoleByNameAsync(string realm, string roleName, CancellationToken cancellationToken = default) => @@ -106,7 +106,7 @@ public async Task GetRoleByNameAsync(string realm, string roleName, Cancel .AppendPathSegment(realm, true) .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) - .GetJsonAsync(cancellationToken) + .GetJsonAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task UpdateRoleByNameAsync(string realm, string clientId, string roleName, Role role) => @@ -158,7 +158,7 @@ public async Task AddCompositesToRoleAsync(string realm, string clientId, string .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) .AppendPathSegment("/composites") - .PostJsonAsync(roles, cancellationToken) + .PostJsonAsync(roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task AddCompositesToRoleAsync(string realm, string roleName, IEnumerable roles, CancellationToken cancellationToken = default) => @@ -168,7 +168,7 @@ public async Task AddCompositesToRoleAsync(string realm, string roleName, IEnume .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) .AppendPathSegment("/composites") - .PostJsonAsync(roles, cancellationToken) + .PostJsonAsync(roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetRoleCompositesAsync(string realm, string clientId, string roleName) => @@ -202,7 +202,7 @@ public async Task RemoveCompositesFromRoleAsync(string realm, string clientId, s .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) .AppendPathSegment("/composites") - .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken) + .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task RemoveCompositesFromRoleAsync(string realm, string roleName, IEnumerable roles, CancellationToken cancellationToken = default) => @@ -212,7 +212,7 @@ public async Task RemoveCompositesFromRoleAsync(string realm, string roleName, I .AppendPathSegment("/roles/") .AppendPathSegment(roleName, true) .AppendPathSegment("/composites") - .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken) + .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetApplicationRolesForCompositeAsync(string realm, string clientId, string roleName, string forClientId) => diff --git a/src/keycloak/Keycloak.Library/RolesById/KeycloakClient.cs b/src/keycloak/Keycloak.Library/RolesById/KeycloakClient.cs index 20edfab19c..101948b5d3 100755 --- a/src/keycloak/Keycloak.Library/RolesById/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/RolesById/KeycloakClient.cs @@ -27,6 +27,7 @@ using Flurl.Http.Content; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Common; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; +using System.Text.Json; namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library; @@ -47,7 +48,7 @@ public async Task UpdateRoleByIdAsync(string realm, string roleId, Role role, Ca .AppendPathSegment(realm, true) .AppendPathSegment("/roles-by-id/") .AppendPathSegment(roleId, true) - .PutJsonAsync(role, cancellationToken) + .PutJsonAsync(role, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteRoleByIdAsync(string realm, string roleId, CancellationToken cancellationToken = default) => @@ -56,7 +57,7 @@ public async Task DeleteRoleByIdAsync(string realm, string roleId, CancellationT .AppendPathSegment(realm, true) .AppendPathSegment("/roles-by-id/") .AppendPathSegment(roleId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task MakeRoleCompositeAsync(string realm, string roleId, IEnumerable roles) => @@ -76,22 +77,9 @@ public async Task> GetRoleChildrenAsync(string realm, string r .AppendPathSegment("/roles-by-id/") .AppendPathSegment(roleId, true) .AppendPathSegment("/composites") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task RemoveRolesFromCompositeAsync(string realm, string roleId, IEnumerable roles) - { - using var jsonContent = new CapturedJsonContent(_serializer.Serialize(roles)); - await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/roles-by-id/") - .AppendPathSegment(roleId, true) - .AppendPathSegment("/composites") - .SendJsonAsync(HttpMethod.Delete, jsonContent) - .ConfigureAwait(ConfigureAwaitOptions.None); - } - public async Task> GetClientRolesForCompositeByIdAsync(string realm, string roleId, string clientId) => await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") diff --git a/src/keycloak/Keycloak.Library/ScopeMappings/KeycloakClient.cs b/src/keycloak/Keycloak.Library/ScopeMappings/KeycloakClient.cs index e7199d35f5..2fe2165865 100644 --- a/src/keycloak/Keycloak.Library/ScopeMappings/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/ScopeMappings/KeycloakClient.cs @@ -166,7 +166,7 @@ public async Task AddClientRolesScopeMappingToClientAsync(string realm, string c .AppendPathSegment(clientId, true) .AppendPathSegment("/scope-mappings/clients/") .AppendPathSegment(scopeClientId, true) - .PostJsonAsync(roles, cancellationToken) + .PostJsonAsync(roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetClientRolesScopeMappingsForClientAsync(string realm, string clientId, string scopeClientId, CancellationToken cancellationToken = default) => @@ -177,7 +177,7 @@ public async Task> GetClientRolesScopeMappingsForClientAsync(s .AppendPathSegment(clientId, true) .AppendPathSegment("/scope-mappings/clients/") .AppendPathSegment(scopeClientId, true) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task RemoveClientRolesFromClientScopeForClientAsync(string realm, string clientId, string scopeClientId, IEnumerable roles, CancellationToken cancellationToken = default) => @@ -188,7 +188,7 @@ public async Task RemoveClientRolesFromClientScopeForClientAsync(string realm, s .AppendPathSegment(clientId, true) .AppendPathSegment("/scope-mappings/clients/") .AppendPathSegment(scopeClientId, true) - .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken) + .SendJsonAsync(HttpMethod.Delete, roles, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetAvailableClientRolesForClientScopeForClientAsync(string realm, string clientId, string scopeClientId) => diff --git a/src/keycloak/Keycloak.Library/Users/KeycloakClient.cs b/src/keycloak/Keycloak.Library/Users/KeycloakClient.cs index 839c6fc6b3..ec44e27326 100644 --- a/src/keycloak/Keycloak.Library/Users/KeycloakClient.cs +++ b/src/keycloak/Keycloak.Library/Users/KeycloakClient.cs @@ -38,7 +38,7 @@ private async Task InternalCreateUserAsync(string realm, User us .AppendPathSegment("/admin/realms/") .AppendPathSegment(realm, true) .AppendPathSegment("/users") - .PostJsonAsync(user, cancellationToken) + .PostJsonAsync(user, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task CreateAndRetrieveUserIdAsync(string realm, User user, CancellationToken cancellationToken = default) @@ -68,7 +68,7 @@ public async Task> GetUsersAsync(string realm, bool? briefRepr .AppendPathSegment(realm, true) .AppendPathSegment("/users") .SetQueryParams(queryParams) - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); } @@ -95,7 +95,7 @@ public async Task UpdateUserAsync(string realm, string userId, User user, Cancel .AppendPathSegment(realm, true) .AppendPathSegment("/users/") .AppendPathSegment(userId, true) - .PutJsonAsync(user, cancellationToken) + .PutJsonAsync(user, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DeleteUserAsync(string realm, string userId) => @@ -114,7 +114,7 @@ public async Task> GetUserConsentsAsync(string realm, s .AppendPathSegment("/users/") .AppendPathSegment(userId, true) .AppendPathSegment("/consents") - .GetJsonAsync>(cancellationToken) + .GetJsonAsync>(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task RevokeUserConsentAndOfflineTokensAsync(string realm, string userId, string clientId, CancellationToken cancellationToken = default) => @@ -125,7 +125,7 @@ public async Task RevokeUserConsentAndOfflineTokensAsync(string realm, string us .AppendPathSegment(userId, true) .AppendPathSegment("/consents/") .AppendPathSegment(clientId, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task DisableUserCredentialsAsync(string realm, string userId, IEnumerable credentialTypes) => @@ -175,7 +175,7 @@ public async Task AddUserSocialLoginProviderAsync(string realm, string userId, s .AppendPathSegment(userId, true) .AppendPathSegment("/federated-identity/") .AppendPathSegment(provider, true) - .PostJsonAsync(federatedIdentity, cancellationToken) + .PostJsonAsync(federatedIdentity, cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task RemoveUserSocialLoginProviderAsync(string realm, string userId, string provider, CancellationToken cancellationToken = default) => @@ -186,7 +186,7 @@ public async Task RemoveUserSocialLoginProviderAsync(string realm, string userId .AppendPathSegment(userId, true) .AppendPathSegment("/federated-identity/") .AppendPathSegment(provider, true) - .DeleteAsync(cancellationToken) + .DeleteAsync(cancellationToken: cancellationToken) .ConfigureAwait(ConfigureAwaitOptions.None); public async Task> GetUserGroupsAsync(string realm, string userId) => @@ -199,16 +199,6 @@ public async Task> GetUserGroupsAsync(string realm, string us .GetJsonAsync>() .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task GetUserGroupsCountAsync(string realm, string userId) => - await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) - .AppendPathSegment("/admin/realms/") - .AppendPathSegment(realm, true) - .AppendPathSegment("/users/") - .AppendPathSegment(userId, true) - .AppendPathSegment("/groups/count") - .GetJsonAsync() - .ConfigureAwait(ConfigureAwaitOptions.None); - public async Task UpdateUserGroupAsync(string realm, string userId, string groupId, Group group) => await (await GetBaseUrlAsync(realm).ConfigureAwait(ConfigureAwaitOptions.None)) .AppendPathSegment("/admin/realms/") diff --git a/src/processes/Invitation.Executor/InvitationProcessService.cs b/src/processes/Invitation.Executor/InvitationProcessService.cs index 3a936a1954..a03281ae84 100644 --- a/src/processes/Invitation.Executor/InvitationProcessService.cs +++ b/src/processes/Invitation.Executor/InvitationProcessService.cs @@ -21,11 +21,9 @@ using Org.Eclipse.TractusX.Portal.Backend.ExternalSystems.Provisioning.Library; using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling; using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Configuration; -using Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Encryption; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; -using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities; using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums; using Org.Eclipse.TractusX.Portal.Backend.Processes.Invitation.Executor.DependencyInjection; using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library; diff --git a/tests/endtoend/EndToEnd.Tests.csproj b/tests/endtoend/EndToEnd.Tests.csproj index da9e7bcad0..ceaa44f381 100644 --- a/tests/endtoend/EndToEnd.Tests.csproj +++ b/tests/endtoend/EndToEnd.Tests.csproj @@ -32,10 +32,9 @@ - - + diff --git a/tests/framework/Framework.Models.Tests/JsonDeserializationTests.cs b/tests/framework/Framework.Models.Tests/JsonDeserializationTests.cs new file mode 100644 index 0000000000..ad6b4a4755 --- /dev/null +++ b/tests/framework/Framework.Models.Tests/JsonDeserializationTests.cs @@ -0,0 +1,72 @@ +/******************************************************************************** + * 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 System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Tests; + +public class JsonDeserializationTests +{ + private readonly JsonSerializerOptions _jsonOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + }; + + [Fact] + public void Serialize_WithSettings_ReturnsExpected() + { + // Arrange + var test = new TestClass + { + TestDict = new Dictionary + { + { "TestUpper", "testValue" }, + { "testSnakeCase", "test" }, + { "testalllower", "testValue" }, + { "TESTALLUPPER", "testValue" } + } + }; + + // Act + var serialized = JsonSerializer.Serialize(test, _jsonOptions); + + // Assert + serialized.Should().Be("""{"testDict":{"TestUpper":"testValue","testSnakeCase":"test","testalllower":"testValue","TESTALLUPPER":"testValue"}}"""); + } + + [Fact] + public void Deserialize_WithSettings_ReturnsExpected() + { + const string Json = """{"testDict":{"TestUpper":"testValue","testSnakeCase":"test","testalllower":"test","TESTALLUPPER":"test"}}"""; + + // Act + var serialized = JsonSerializer.Deserialize(Json, _jsonOptions); + + // Assert + serialized.Should().NotBeNull(); + serialized!.TestDict.Should().ContainKeys("TestUpper", "testSnakeCase", "testalllower", "TESTALLUPPER"); + } + + internal class TestClass + { + public IDictionary TestDict { get; set; } = null!; + } +} diff --git a/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs b/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs index 2e8f9f0d50..cd91cc60e2 100644 --- a/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs +++ b/tests/framework/Framework.Models.Tests/ValidationExpressionsTests.cs @@ -18,8 +18,6 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -using System.Text.RegularExpressions; - namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Models.Tests; public class ValidationExpressionsTests diff --git a/tests/provisioning/Provisioning.Library.Tests/IdentityProviderManagerTests.cs b/tests/provisioning/Provisioning.Library.Tests/IdentityProviderManagerTests.cs new file mode 100644 index 0000000000..5bff42c077 --- /dev/null +++ b/tests/provisioning/Provisioning.Library.Tests/IdentityProviderManagerTests.cs @@ -0,0 +1,123 @@ +/******************************************************************************** + * Copyright (c) 2023 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.Testing; +using Microsoft.Extensions.Options; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Factory; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; +using Org.Eclipse.TractusX.Portal.Backend.Provisioning.DBAccess; +using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Enums; +using Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.FlurlSetup; +using Config = Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders.Config; +using IdentityProvider = Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders.IdentityProvider; + +namespace Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Tests; + +public class IdentityProviderManagerTests +{ + private const string CentralRealm = "test"; + private const string CentralUrl = "https://central.de"; + private readonly IProvisioningManager _sut; + + public IdentityProviderManagerTests() + { + var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization { ConfigureMembers = true }); + fixture.Behaviors.OfType().ToList() + .ForEach(b => fixture.Behaviors.Remove(b)); + fixture.Behaviors.Add(new OmitOnRecursionBehavior()); + + var keycloakFactory = A.Fake(); + var provisioningDbAccess = A.Fake(); + A.CallTo(() => keycloakFactory.CreateKeycloakClient("central")) + .Returns(new KeycloakClient(CentralUrl, "test", "test", "test", false)); + var settings = new ProvisioningSettings + { + ClientPrefix = "cl", + CentralOIDCClient = new Client + { + RedirectUris = new List() + }, + CentralRealm = CentralRealm, + CentralIdentityProvider = new IdentityProvider + { + ProviderId = "keycloak-oidc", + FirstBrokerLoginFlowAlias = "first broker login", + Config = new Config + { + ClientAuthMethod = "private_key_jwt", + HideOnLoginPage = "true", + SyncMode = "true" + } + }, + ServiceAccountClientPrefix = "sa", + ServiceAccountClient = new Client + { + Protocol = "openid-connect" + }, + SharedRealm = new Realm + { + Enabled = true, + }, + SharedRealmClient = new Client + { + Protocol = "openid-connect", + ClientAuthenticatorType = "client-jwt", + Enabled = true, + Attributes = new Dictionary() + }, + }; + + _sut = new ProvisioningManager(keycloakFactory, provisioningDbAccess, Options.Create(settings)); + } + + [Fact] + public async Task GetIdentityProviderMappers_WithFilledDictionary_ReturnsExpected() + { + // Arrange + using var httpTest = new HttpTest(); + var idpMapper = new IdentityProviderMapper + { + Id = "test123", + Name = "test", + _IdentityProviderMapper = "oidc-username-idp-mapper", + Config = new Dictionary + { + { "Test", "testValue1" }, + { "NewerTest", "testValue2" }, + { "lowerTest", "newValue" } + } + }; + httpTest + .WithAuthorization() + .WithIdentityProviderMappersAsync(Enumerable.Repeat(idpMapper, 1)); + + // Act + var result = await _sut.GetIdentityProviderMappers("test").ToListAsync(); + + // Assert + result.Should().ContainSingle().And.Satisfy(x => + x.Id == "test123" && + x.Name == "test" && + x.Type == IdentityProviderMapperType.OIDC_USERNAME && + x.Config.Keys.Count == 3 && x.Config.ContainsKey("Test") && x.Config.ContainsKey("NewerTest") && x.Config.ContainsKey("lowerTest")); + } +} diff --git a/tests/shared/Tests.Shared/FlurlSetup/FlurlSetupExtensions.cs b/tests/shared/Tests.Shared/FlurlSetup/FlurlSetupExtensions.cs index 39ccc806cd..1e9996cf5f 100644 --- a/tests/shared/Tests.Shared/FlurlSetup/FlurlSetupExtensions.cs +++ b/tests/shared/Tests.Shared/FlurlSetup/FlurlSetupExtensions.cs @@ -20,11 +20,14 @@ using Flurl.Http; using Flurl.Http.Testing; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Clients; +using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.IdentityProviders; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.OpenIDConfiguration; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Roles; using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.Users; +using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library.Models; using System.Net; +using IdentityProvider = Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Models.RealmsAdmin.IdentityProvider; namespace Org.Eclipse.TractusX.Portal.Backend.Tests.Shared.FlurlSetup; @@ -127,8 +130,16 @@ public static HttpTest WithGetUsersFailing(this HttpTest testClient, HttpStatusC HttpRequestMessage = new HttpRequestMessage(HttpMethod.Get, "/test"), Request = new FlurlRequest(new Uri("https://test.de")), HttpResponseMessage = new HttpResponseMessage(statusCode) { ReasonPhrase = "test" }, - Response = new FlurlResponse(new HttpResponseMessage(statusCode)) + Response = new FlurlResponse(new FlurlCall { HttpResponseMessage = new HttpResponseMessage(statusCode) }) })); return testClient; } + + public static HttpTest WithIdentityProviderMappersAsync(this HttpTest testClient, IEnumerable idpMappers) + { + testClient.ForCallsTo("*/admin/realms/*/identity-provider/instances/*/mappers") + .WithVerb(HttpMethod.Get) + .RespondWithJson(idpMappers); + return testClient; + } } diff --git a/tests/shared/Tests.Shared/Tests.Shared.csproj b/tests/shared/Tests.Shared/Tests.Shared.csproj index e7ba157f3a..9669e6e15a 100644 --- a/tests/shared/Tests.Shared/Tests.Shared.csproj +++ b/tests/shared/Tests.Shared/Tests.Shared.csproj @@ -28,15 +28,14 @@ - - - + +