Updating RMS

This commit is contained in:
Zeeshaun
2026-03-23 19:23:05 +00:00
parent 71b614ec92
commit 69648a3b8f
6 changed files with 55 additions and 11 deletions
@@ -40,7 +40,11 @@ namespace ReserveManagementSystemUI.Helpers
} }
var userName = authState.User.Identity.Name; var userName = authState.User.Identity.Name;
return userName[4..]; var slashIndex = userName.IndexOf('\\');
return slashIndex >= 0 && slashIndex < userName.Length - 1
? userName[(slashIndex + 1)..]
: userName;
} }
} }
} }
@@ -9,10 +9,14 @@
<PackageReference Include="Blazored.Modal" Version="6.0.1" /> <PackageReference Include="Blazored.Modal" Version="6.0.1" />
<PackageReference Include="Blazored.Toast" Version="3.1.2" /> <PackageReference Include="Blazored.Toast" Version="3.1.2" />
<PackageReference Include="Blazored.Typeahead" Version="4.6.0" /> <PackageReference Include="Blazored.Typeahead" Version="4.6.0" />
<PackageReference Include="LCU.Library.Internal.Configuration" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.LcuHttpClient" Version="1.17.0" /> <PackageReference Include="LCU.Library.Internal.LcuHttpClient" Version="1.17.0" />
<PackageReference Include="LCU.Library.Internal.Logging" Version="1.0.0" /> <PackageReference Include="LCU.Library.Internal.Logging" Version="1.0.0" />
<PackageReference Include="LCU.Library.Internal.RazorComponents" Version="1.2.0" /> <PackageReference Include="LCU.Library.Internal.RazorComponents" Version="1.2.0" />
<PackageReference Include="LCU.Library.Internal.Security" Version="2.0.1" />
<PackageReference Include="LCU.Shared.Common.NotificationApiLib" Version="2.0.0" /> <PackageReference Include="LCU.Shared.Common.NotificationApiLib" Version="2.0.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.11.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="3.11.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ReserveManagementSystemLib" Version="2.1.0" /> <PackageReference Include="ReserveManagementSystemLib" Version="2.1.0" />
<PackageReference Include="Serilog" Version="2.11.0" /> <PackageReference Include="Serilog" Version="2.11.0" />
@@ -1,5 +1,9 @@
<AuthorizeView > @inject ReserveManagementSystemUI.Helpers.ServiceHelpers ServiceHelpers
<AuthorizeView>
<Authorized>
<div class="login-Display"> <div class="login-Display">
Hello, @context.User.Identity.Name.Substring(4) Hello, @ServiceHelpers.GetUserName()
</div> </div>
</Authorized>
</AuthorizeView> </AuthorizeView>
@@ -3,7 +3,10 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Identity.Web;
using Microsoft.Identity.Web.UI;
using Blazored.Toast; using Blazored.Toast;
using LCU.Library.Internal.Configuration;
using LCU.Library.Internal.LcuHttpClient; using LCU.Library.Internal.LcuHttpClient;
using ReserveManagementSystemUI.Service; using ReserveManagementSystemUI.Service;
using ReserveManagementSystemUI.Services; using ReserveManagementSystemUI.Services;
@@ -12,6 +15,7 @@ using Blazored.Modal;
using ReserveManagementSystemUI.Model.Configuration; using ReserveManagementSystemUI.Model.Configuration;
using LCU.Library.Internal.Logging; using LCU.Library.Internal.Logging;
using LCU.Library.Internal.Logging.Models; using LCU.Library.Internal.Logging.Models;
using LCU.Library.Internal.Security;
namespace ReserveManagementSystemUI 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 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddAzureAdGroupPolicyServicesWithToken(Configuration.GetSection("AzureAd"),
Configuration.GetSection("Security"));
var appConfiguration = new AppConfiguration(); var appConfiguration = new AppConfiguration();
Configuration.GetSection("Primary").Bind(appConfiguration); Configuration.GetSection("Primary").Bind(appConfiguration);
@@ -38,7 +45,8 @@ namespace ReserveManagementSystemUI
lcuLogging.UseLcuLogging(); lcuLogging.UseLcuLogging();
services.AddRazorPages(); services.AddRazorPages();
services.AddServerSideBlazor(); services.AddControllersWithViews().AddMicrosoftIdentityUI();
services.AddServerSideBlazor().AddMicrosoftIdentityConsentHandler();
LcuConfigureServicesAddons(services); LcuConfigureServicesAddons(services);
} }
@@ -52,11 +60,6 @@ namespace ReserveManagementSystemUI
services.AddSingleton(rmsUIConfiguration); services.AddSingleton(rmsUIConfiguration);
services.AddSingleton<IConfiguration>(Configuration); services.AddSingleton<IConfiguration>(Configuration);
services.AddAuthentication();
services.AddAuthorization(config =>
{
config.AddPolicy("IsRMSAssociate", policy => policy.RequireRole(rmsUIConfiguration.RmsAssociatesRoles.Split(',')));
});
services.AddLCUHttpServices(); services.AddLCUHttpServices();
services.AddHttpContextAccessor(); services.AddHttpContextAccessor();
@@ -91,9 +94,13 @@ namespace ReserveManagementSystemUI
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers();
endpoints.MapRazorPages();
endpoints.MapBlazorHub(); endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host"); endpoints.MapFallbackToPage("/_Host");
}); });
@@ -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": { "Primary": {
"AppName": "Reserve Management System", "AppName": "Reserve Management System",
"SeqApiKey": "VALUE-IN-KEYVAULT", "SeqApiKey": "VALUE-IN-KEYVAULT",
@@ -15,5 +23,12 @@
"DefaultImportTimeout": 10, "DefaultImportTimeout": 10,
"RMSAssociatesRoles": "Reserve Management System - Associates", "RMSAssociatesRoles": "Reserve Management System - Associates",
"ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/" "ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/"
},
"Security": {
"AccessPolicies": {
"IsRMSAssociate": {
"Groups": "Reserve Management System - Associates"
}
}
} }
} }
@@ -2,6 +2,9 @@
"Primary": { "Primary": {
"SeqUrl": "https://qa-seq.lcu-internal.com" "SeqUrl": "https://qa-seq.lcu-internal.com"
}, },
"AzureAd": {
"CallbackPath": "/signin-oidc"
},
"RmsUIConfiguration": { "RmsUIConfiguration": {
"AllowedHosts": "*", "AllowedHosts": "*",
"NotificationsUrl": "https://qa-notificationsapi.lcu-internal.com/api/", "NotificationsUrl": "https://qa-notificationsapi.lcu-internal.com/api/",
@@ -13,5 +16,12 @@
"DefaultImportTimeout": 10, "DefaultImportTimeout": 10,
"RMSAssociatesRoles": "Reserve Management System - Associates", "RMSAssociatesRoles": "Reserve Management System - Associates",
"ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/" "ReportServerUrl": "https://d2dtbetl01q.lcu-internal.com/reports/report/RMS/"
},
"Security": {
"AccessPolicies": {
"IsRMSAssociate": {
"Groups": "Reserve Management System - Associates"
}
}
} }
} }