From 69648a3b8f718f60229869899bed7999befa63d4 Mon Sep 17 00:00:00 2001 From: Zeeshaun Date: Mon, 23 Mar 2026 19:23:05 +0000 Subject: [PATCH] Updating RMS --- .../Helpers/ServiceHelpers.cs | 6 +++++- .../ReserveManagementSystemUI.csproj | 4 ++++ .../Shared/LoginDisplay.razor | 12 ++++++++---- .../ReserveManagementSystemUI/Startup.cs | 19 +++++++++++++------ .../appsettings.json | 15 +++++++++++++++ .../overlays/qa/appsettings/appsettings.json | 10 ++++++++++ 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Helpers/ServiceHelpers.cs b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Helpers/ServiceHelpers.cs index 2300141..662601f 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Helpers/ServiceHelpers.cs +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Helpers/ServiceHelpers.cs @@ -40,7 +40,11 @@ namespace ReserveManagementSystemUI.Helpers } var userName = authState.User.Identity.Name; - return userName[4..]; + var slashIndex = userName.IndexOf('\\'); + + return slashIndex >= 0 && slashIndex < userName.Length - 1 + ? userName[(slashIndex + 1)..] + : userName; } } } diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/ReserveManagementSystemUI.csproj b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/ReserveManagementSystemUI.csproj index 593f60a..77d35df 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/ReserveManagementSystemUI.csproj +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/ReserveManagementSystemUI.csproj @@ -9,10 +9,14 @@ + + + + diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Shared/LoginDisplay.razor b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Shared/LoginDisplay.razor index f57da24..0056308 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Shared/LoginDisplay.razor +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Shared/LoginDisplay.razor @@ -1,5 +1,9 @@ - - +@inject ReserveManagementSystemUI.Helpers.ServiceHelpers ServiceHelpers + + + + + diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Startup.cs b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Startup.cs index 9bd1027..b687b89 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Startup.cs +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/Startup.cs @@ -3,7 +3,10 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Identity.Web; +using Microsoft.Identity.Web.UI; using Blazored.Toast; +using LCU.Library.Internal.Configuration; using LCU.Library.Internal.LcuHttpClient; using ReserveManagementSystemUI.Service; using ReserveManagementSystemUI.Services; @@ -12,6 +15,7 @@ using Blazored.Modal; using ReserveManagementSystemUI.Model.Configuration; using LCU.Library.Internal.Logging; using LCU.Library.Internal.Logging.Models; +using LCU.Library.Internal.Security; namespace ReserveManagementSystemUI { @@ -28,6 +32,9 @@ namespace ReserveManagementSystemUI // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { + services.AddAzureAdGroupPolicyServicesWithToken(Configuration.GetSection("AzureAd"), + Configuration.GetSection("Security")); + var appConfiguration = new AppConfiguration(); Configuration.GetSection("Primary").Bind(appConfiguration); @@ -38,7 +45,8 @@ namespace ReserveManagementSystemUI lcuLogging.UseLcuLogging(); services.AddRazorPages(); - services.AddServerSideBlazor(); + services.AddControllersWithViews().AddMicrosoftIdentityUI(); + services.AddServerSideBlazor().AddMicrosoftIdentityConsentHandler(); LcuConfigureServicesAddons(services); } @@ -52,11 +60,6 @@ namespace ReserveManagementSystemUI services.AddSingleton(rmsUIConfiguration); services.AddSingleton(Configuration); - services.AddAuthentication(); - services.AddAuthorization(config => - { - config.AddPolicy("IsRMSAssociate", policy => policy.RequireRole(rmsUIConfiguration.RmsAssociatesRoles.Split(','))); - }); services.AddLCUHttpServices(); services.AddHttpContextAccessor(); @@ -91,9 +94,13 @@ namespace ReserveManagementSystemUI app.UseStaticFiles(); app.UseRouting(); + app.UseAuthentication(); + app.UseAuthorization(); app.UseEndpoints(endpoints => { + endpoints.MapControllers(); + endpoints.MapRazorPages(); endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); }); diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/appsettings.json b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/appsettings.json index 5486533..45a0f38 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/appsettings.json +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/ReserveManagementSystemUI/appsettings.json @@ -1,4 +1,12 @@ { + "AzureAd": { + "Instance": "https://login.microsoftonline.com/", + "Domain": "landmarkcu.onmicrosoft.com", + "TenantId": "00000000-0000-0000-0000-000000000000", + "ClientId": "00000000-0000-0000-0000-000000000000", + "CallbackPath": "/signin-oidc", + "ClientSecret": "VALUE-IN-KEYVAULT" + }, "Primary": { "AppName": "Reserve Management System", "SeqApiKey": "VALUE-IN-KEYVAULT", @@ -15,5 +23,12 @@ "DefaultImportTimeout": 10, "RMSAssociatesRoles": "Reserve Management System - Associates", "ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/" + }, + "Security": { + "AccessPolicies": { + "IsRMSAssociate": { + "Groups": "Reserve Management System - Associates" + } + } } } diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/kustomize/overlays/qa/appsettings/appsettings.json b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/kustomize/overlays/qa/appsettings/appsettings.json index 7f2d110..42b47cb 100644 --- a/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/kustomize/overlays/qa/appsettings/appsettings.json +++ b/LCU.WebApps.Indirect.ReserveManagementSystem/WebApp/kustomize/overlays/qa/appsettings/appsettings.json @@ -2,6 +2,9 @@ "Primary": { "SeqUrl": "https://qa-seq.lcu-internal.com" }, + "AzureAd": { + "CallbackPath": "/signin-oidc" + }, "RmsUIConfiguration": { "AllowedHosts": "*", "NotificationsUrl": "https://qa-notificationsapi.lcu-internal.com/api/", @@ -13,5 +16,12 @@ "DefaultImportTimeout": 10, "RMSAssociatesRoles": "Reserve Management System - Associates", "ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/" + }, + "Security": { + "AccessPolicies": { + "IsRMSAssociate": { + "Groups": "Reserve Management System - Associates" + } + } } }