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;
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.Toast" Version="3.1.2" />
<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.Logging" Version="1.0.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="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="ReserveManagementSystemLib" Version="2.1.0" />
<PackageReference Include="Serilog" Version="2.11.0" />
@@ -1,5 +1,9 @@
<AuthorizeView >
<div class="login-Display">
Hello, @context.User.Identity.Name.Substring(4)
</div>
@inject ReserveManagementSystemUI.Helpers.ServiceHelpers ServiceHelpers
<AuthorizeView>
<Authorized>
<div class="login-Display">
Hello, @ServiceHelpers.GetUserName()
</div>
</Authorized>
</AuthorizeView>
@@ -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<IConfiguration>(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");
});
@@ -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"
}
}
}
}
@@ -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"
}
}
}
}