| 64 |
if (-not $pscmdlet.ShouldProcess($Application.ClientID)) { ... |
| 67 |
$Client_Id = [System.Web.HttpUtility]::UrlEncode($Application.ClientId) |
| 68 |
$Redirect_Uri = [System.Web.HttpUtility]::UrlEncode($Application.RedirectUri) |
| 69 |
$Url = "{0}?response_type=code&redirect_uri={1}&client_id={2}" -f @( ... |
| 70 |
$BaseURL |
| 71 |
$Redirect_Uri |
| 72 |
$Client_Id |
| 74 |
Write-Verbose "URL: '$URL'" |
| 75 |
$Params = @{ ... |
| 76 |
TypeName = 'System.Windows.Forms.Form' |
| 77 |
Property = @{ ... |
| 78 |
Width = 440 |
| 79 |
Height = 640 |
| 82 |
$Form = New-Object @Params |
| 83 |
$Params = @{ ... |
| 84 |
TypeName = 'System.Windows.Forms.WebBrowser' |
| 85 |
Property = @{ ... |
| 86 |
Width = 420 |
| 87 |
Height = 600 |
| 88 |
Url = $Url |
| 91 |
$Web = New-Object @Params |
| 92 |
$DocumentCompleted_Script = { ... |
| 93 |
if ($web.Url.AbsoluteUri -match "error=[^&]*... |
| 94 |
$form.Close() |
| 98 |
$web.ScriptErrorsSuppressed = $false |
| 99 |
$web.Add_DocumentCompleted($DocumentCompleted_Script) |
| 100 |
$form.Controls.Add($web) |
| 101 |
$form.Add_Shown({ $form.Activate() }) |
| 101 |
$form.Activate() |
| 102 |
[void]$form.ShowDialog() |
| 104 |
$QueryOutput = [System.Web.HttpUtility]::ParseQueryString($web.Url.Query) |
| 105 |
$Response = @{ } |
| 106 |
$queryOutput.Keys |
| 107 |
$Response["$key"] = $QueryOutput[$key] |
| 109 |
$SecAuthCode = 'NOAUTHCODE' ... |
| 109 |
$SecAuthCode = 'NOAUTHCODE' ... |
| 110 |
$AuthCodeCredential = [pscredential]::new('NOAUTHCODE', $SecAuthCode) |
| 111 |
if ($Response.Code) { ... |
| 112 |
$SecAuthCode = $Response.Code ... |
| 112 |
$SecAuthCode = $Response.Code ... |
| 113 |
$AuthCodeCredential = [pscredential]::new('AuthCode', $SecAuthCode) |
| 114 |
$Response.Remove('Code') |
| 116 |
[pscustomobject]@{ ... |
| 117 |
PSTypeName = 'MSGraphAPI.Oauth.AuthorizationCode' |
| 118 |
AuthCodeCredential = $AuthCodeCredential |
| 119 |
ResultURL = $web.Url.psobject.copy() |
| 120 |
Application = $Application |
| 121 |
AuthCodeBaseURL = $BaseURL |
| 122 |
Response = $Response |
| 123 |
Issued = Get-date |
| 125 |
[void]$form.Close() |
| 126 |
[void]$Web.Dispose() |
| 127 |
[void]$Form.Dispose() |
Code coverage report:
Covered 0 % of 53 analyzed Commands in
Get-GraphOauthAuthorizationCodeMissed commands:
if (-not $pscmdlet.ShouldProcess($Application.ClientID)) { ...$Client_Id = [System.Web.HttpUtility]::UrlEncode($Application.ClientId)$Redirect_Uri = [System.Web.HttpUtility]::UrlEncode($Application.RedirectUri)$Url = "{0}?response_type=code&redirect_uri={1}&client_id={2}" -f @( ...$BaseURL$Redirect_Uri$Client_IdWrite-Verbose "URL: '$URL'"$Params = @{ ...TypeName = 'System.Windows.Forms.Form'Property = @{ ...Width = 440Height = 640$Form = New-Object @Params$Params = @{ ...TypeName = 'System.Windows.Forms.WebBrowser'Property = @{ ...Width = 420Height = 600Url = $Url$Web = New-Object @Params$DocumentCompleted_Script = { ...if ($web.Url.AbsoluteUri -match "error=[^&]*...$form.Close()$web.ScriptErrorsSuppressed = $false$web.Add_DocumentCompleted($DocumentCompleted_Script)$form.Controls.Add($web)$form.Add_Shown({ $form.Activate() })$form.Activate()[void]$form.ShowDialog()$QueryOutput = [System.Web.HttpUtility]::ParseQueryString($web.Url.Query)$Response = @{ }$queryOutput.Keys$Response["$key"] = $QueryOutput[$key]$SecAuthCode = 'NOAUTHCODE' ...$SecAuthCode = 'NOAUTHCODE' ...$AuthCodeCredential = [pscredential]::new('NOAUTHCODE', $SecAuthCode)if ($Response.Code) { ...$SecAuthCode = $Response.Code ...$SecAuthCode = $Response.Code ...$AuthCodeCredential = [pscredential]::new('AuthCode', $SecAuthCode)$Response.Remove('Code')[pscustomobject]@{ ...PSTypeName = 'MSGraphAPI.Oauth.AuthorizationCode'AuthCodeCredential = $AuthCodeCredentialResultURL = $web.Url.psobject.copy()Application = $ApplicationAuthCodeBaseURL = $BaseURLResponse = $ResponseIssued = Get-date[void]$form.Close()[void]$Web.Dispose()[void]$Form.Dispose()