Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Authentication/Test-CIPPAccess.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function Test-CIPPAccess {
$swUserBranch = [System.Diagnostics.Stopwatch]::StartNew()
$User = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Request.Headers.'x-ms-client-principal')) | ConvertFrom-Json

if ($User.claims -and [string]::IsNullOrWhiteSpace($User.userDetails)) {
if ($User.claims -and [string]::IsNullOrWhiteSpace($User.userDetails)) {
$Claims = @($User.claims)
$Upn = ($Claims | Where-Object { $_.typ -in @('preferred_username', 'upn', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn', 'email', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress') } | Select-Object -First 1).val
if ([string]::IsNullOrWhiteSpace($Upn)) { $Upn = $Request.Headers.'x-ms-client-principal-name' }
Expand All @@ -159,7 +159,7 @@ function Test-CIPPAccess {

$swIPCheck = [System.Diagnostics.Stopwatch]::StartNew()
if (-not $User.userRoles) {
throw 'Access denied: unable to resolve roles for the authenticated principal, here is what we know about this user: ' + ($User | ConvertTo-Json -Depth 5) + ' and here is what we know about the request: ' + ($Request | ConvertTo-Json -Depth 5)
throw 'Access denied: unable to resolve roles for the authenticated principal'
}
$AllowedIPRanges = Get-CIPPRoleIPRanges -Roles $User.userRoles

Expand Down