-
- Hello, @context.User.Identity.Name.Substring(4)
-
+@inject ReserveManagementSystemUI.Helpers.ServiceHelpers ServiceHelpers
+
+
+
+
+ Hello, @ServiceHelpers.GetUserName()
+
+
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"
+ }
+ }
}
}