-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(openUrl): Add Endpoints for public apis foreach service (#161)
* add GET endpoint to all services /api/info to receive the api endpoints filtered for the companyRole * test(openApi): add unit tests for GetPublicUrls Refs: CPLP-2958 --------- Co-authored-by: Norbert Truchsess <[email protected]> Reviewed-By: Norbert Truchsess <[email protected]>
- Loading branch information
Showing
55 changed files
with
1,757 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ework/Framework.PublicInfos/DependencyInjection/PublicInfosServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 BMW Group AG | ||
* Copyright (c) 2021, 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 Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Org.Eclipse.TractusX.Portal.Backend.Framework.PublicInfos.DependencyInjection; | ||
|
||
public static class PublicInfosServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddPublicInfos(this IServiceCollection services) | ||
{ | ||
services | ||
.AddTransient<IPublicInformationBusinessLogic, PublicInformationBusinessLogic>(); | ||
|
||
return services; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/framework/Framework.PublicInfos/Framework.PublicInfos.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- | ||
- Copyright (c) 2021, 2023 BMW Group AG | ||
- Copyright (c) 2021, 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 | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AssemblyName>Org.Eclipse.TractusX.Portal.Backend.Framework.PublicInfos</AssemblyName> | ||
<RootNamespace>Org.Eclipse.TractusX.Portal.Backend.Framework.PublicInfos</RootNamespace> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\keycloak\Keycloak.Authentication\Keycloak.Authentication.csproj" /> | ||
<ProjectReference Include="..\..\keycloak\Keycloak.ErrorHandling\Keycloak.ErrorHandling.csproj" /> | ||
<ProjectReference Include="..\..\keycloak\Keycloak.Factory\Keycloak.Factory.csproj" /> | ||
<ProjectReference Include="..\Framework.Cors\Framework.Cors.csproj" /> | ||
<ProjectReference Include="..\Framework.DateTimeProvider\Framework.DateTimeProvider.csproj" /> | ||
<ProjectReference Include="..\Framework.ErrorHandling.Web\Framework.ErrorHandling.Web.csproj" /> | ||
<ProjectReference Include="..\Framework.Swagger\Framework.Swagger.csproj" /> | ||
<ProjectReference Include="..\Framework.Authorization\Framework.Authorization.csproj" /> | ||
<ProjectReference Include="..\Framework.Linq\Framework.Linq.csproj" /> | ||
<ProjectReference Include="..\Framework.Logging\Framework.Logging.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" /> | ||
<PackageReference Include="Serilog.Enrichers.CorrelationId" Version="3.0.1" /> | ||
</ItemGroup> | ||
</Project> |
26 changes: 26 additions & 0 deletions
26
src/framework/Framework.PublicInfos/IPublicInformationBusinessLogic.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 BMW Group AG | ||
* Copyright (c) 2021, 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 | ||
********************************************************************************/ | ||
|
||
namespace Org.Eclipse.TractusX.Portal.Backend.Framework.PublicInfos; | ||
|
||
public interface IPublicInformationBusinessLogic | ||
{ | ||
Task<IEnumerable<UrlInformation>> GetPublicUrls(); | ||
} |
56 changes: 56 additions & 0 deletions
56
src/framework/Framework.PublicInfos/OpenInformationController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021, 2023 BMW Group AG | ||
* Copyright (c) 2021, 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 Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models; | ||
using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication; | ||
|
||
namespace Org.Eclipse.TractusX.Portal.Backend.Framework.PublicInfos; | ||
|
||
[ApiController] | ||
[Route("api/info")] | ||
public class OpenInformationController : ControllerBase | ||
{ | ||
private readonly IPublicInformationBusinessLogic _publicInformationBusinessLogic; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="OpenInformationController"/> | ||
/// </summary> | ||
/// <param name="publicInformationBusinessLogic">The business logic</param> | ||
public OpenInformationController(IPublicInformationBusinessLogic publicInformationBusinessLogic) | ||
{ | ||
_publicInformationBusinessLogic = publicInformationBusinessLogic; | ||
} | ||
|
||
/// <summary> | ||
/// Gets all open information based on the | ||
/// </summary> | ||
/// <remarks> | ||
/// Example: GET: api/info | ||
/// </remarks> | ||
/// <response code="200">Successfully executed the invitation.</response> | ||
[HttpGet] | ||
[Authorize(Policy = PolicyTypes.ValidCompany)] | ||
[ProducesResponseType(typeof(IEnumerable<UrlInformation>), StatusCodes.Status200OK)] | ||
public Task<IEnumerable<UrlInformation>> GetOpenUrls() => | ||
_publicInformationBusinessLogic.GetPublicUrls(); | ||
} |
Oops, something went wrong.