Trying to use an Authorization policy and its not working.
As soon as I use the -AuthorizationPolicy “Login” switch on the $Page1 definition the dashboard fails to load after logging in.
If I remove the -AuthorizationPolicy “Login” I login via Azure and the Dashboard loads fine.
Debug log shows this.
12:19:31 [Info] Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor Executing ContentResult with HTTP Response ContentType of text/css
12:19:31 [Info] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker Executed action UniversalDashboard.Controllers.DashboardController.Theme (UniversalDashboard) in 1.8749ms
12:19:31 [Info] Microsoft.AspNetCore.Hosting.Internal.WebHost Request finished in 6.1859ms 200 text/css
12:19:31 [Info] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker Route matched with {action = “Index”, controller = “Dashboard”, area = “”, page = “”}. Executing action UniversalDashboard.Controllers.DashboardController.Index (UniversalDashboard)
12:19:31 [Info] Microsoft.AspNetCore.Authorization.DefaultAuthorizationService Authorization was successful.
12:19:31 [Info] Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker Executing action method UniversalDashboard.Controllers.DashboardController.Index (UniversalDashboard) - Validation state: Valid
12:19:31 [Debug] DashboardController Index
12:19:31 [Debug] AuthorizationService Authorization policies present.
12:19:31 [Debug] AuthorizationService Checking page Page One.
12:19:31 [Debug] AuthorizationService Page authorized.
12:19:31 [Debug] AuthorizationService Checking page Page Two.
12:19:31 [Debug] AuthorizationService Checking policy Login.
12:19:36 [Debug] Quartz.Core.QuartzSchedulerThread Batch acquisition of 0 triggers
then just repeats the last line.
Heres my code. (sensitive bits removed)
Import-Module UniversalDashboard
$Page1 = New-UDPage -Name "Page One" -Icon mail_bulk -Content {
New-UDCard -Title "Some Data" -Content {
}
}
$Page2 = New-UDPage -Name "Page Two" -Icon home -AuthorizationPolicy "Login" -Content {
New-UDCard -Title "Same Data" -Endpoint {
}
}
$Certificate = (Get-ChildItem -Path Cert:\LocalMachine\My\<REDACTED>)
$AzureADParams = @{
ClientID = '<REDACTED>'
Instance = '<REDACTED>'
Domain = '<REDACTED>'
TenantID = '<REDACTED>'
}
$AuthenticationMethod = New-UDAuthenticationMethod @AzureADParams
$AuthPolicy = New-UDAuthorizationPolicy -Name "Login" -Endpoint {
$true
}
$LoginPage = New-UDLoginPage -AuthenticationMethod $AuthenticationMethod -AuthorizationPolicy $AuthPolicy
$ServiceOps = New-UDDashboard -Title "ServiceOps" -Pages @($Page1, $Page2) -LoginPage $LoginPage
Enable-UDLogging -Level Debug -Console
Start-UDDashboard -Port 443 -Dashboard $ServiceOps -Name "ServiceOps" -Certificate $Certificate -AutoReload