Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jan 6, 2025
1 parent 9487b8c commit 968f43c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Function Invoke-ExecSendPush {
$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

$TenantFilter = $Request.Query.TenantFilter
$UserEmail = $Request.Query.UserEmail
$TenantFilter = $Request.body.TenantFilter
$UserEmail = $Request.body.UserEmail
$MFAAppID = '981f26a1-7f43-403b-a875-f8b09b8cd720'

# Function to keep trying to get the access token while we wait for MS to actually set the temp password
Expand Down Expand Up @@ -92,7 +92,7 @@ Function Invoke-ExecSendPush {
try {
$ClientToken = get-clientaccess -Uri $ClientUri -Body $body
} catch {
$Body = 'Failed to create temporary password'
$Body = 'Failed to create temporary token for MFA Application. Error: ' + $_.Exception.Message
}

# If we got a token send a push
Expand All @@ -104,6 +104,7 @@ Function Invoke-ExecSendPush {

if ($obj.BeginTwoWayAuthenticationResponse.result) {
$Body = "Received an MFA confirmation: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)"
$colour = 'success'
}
if ($obj.BeginTwoWayAuthenticationResponse.AuthenticationResult -ne $true) {
$Body = "Authentication Failed! Does the user have Push/Phone call MFA configured? Errorcode: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)"
Expand All @@ -112,7 +113,7 @@ Function Invoke-ExecSendPush {

}

$Results = [pscustomobject]@{'Results' = $Body; state = $colour }
$Results = [pscustomobject]@{'Results' = $Body; severity = $colour }
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Sent push request to $UserEmail - Result: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)" -Sev 'Info'

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
Expand Down

0 comments on commit 968f43c

Please sign in to comment.