Skip to content

Commit

Permalink
Merge branch 'develop' into Issue-1361
Browse files Browse the repository at this point in the history
  • Loading branch information
Badgerati authored Sep 22, 2024
2 parents ef5d5f7 + d51eda6 commit 7e97569
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/Private/Authentication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2180,22 +2180,29 @@ function Get-PodeAuthADGroupAll {
}

function Get-PodeAuthDomainName {
if (Test-PodeIsUnix) {
$dn = (dnsdomainname)
if ([string]::IsNullOrWhiteSpace($dn)) {
$dn = (/usr/sbin/realm list --name-only)
}
$domain = $null

return $dn
if (Test-PodeIsMacOS) {
$domain = (scutil --dns | grep -m 1 'search domain\[0\]' | cut -d ':' -f 2)
}
elseif (Test-PodeIsUnix) {
$domain = (dnsdomainname)
if ([string]::IsNullOrWhiteSpace($domain)) {
$domain = (/usr/sbin/realm list --name-only)
}
}
else {
$domain = $env:USERDNSDOMAIN
if ([string]::IsNullOrWhiteSpace($domain)) {
$domain = (Get-CimInstance -Class Win32_ComputerSystem -Verbose:$false).Domain
}
}

return $domain
if (![string]::IsNullOrEmpty($domain)) {
$domain = $domain.Trim()
}

return $domain
}

function Find-PodeAuth {
Expand Down

0 comments on commit 7e97569

Please sign in to comment.