[英]PowerShell Preemptive Authentication
我有點被困在這里,我試圖通過PowerShell使用“ GET”到內部Web應用程序(我未創建)使用憑據和客戶端令牌進行HTTP調用。 我不斷從服務器收到錯誤500。
此應用程序需要搶先身份驗證。 我第一次在ReadyAPI中使用此功能時,選擇了“先行身份驗證”廣播,該請求有效。
這是根據ReadyAPI定義的單選按鈕
搶占式身份驗證-指定ReadyAPI是否將等待直到收到授權質詢以發送憑據。 該參數具有以下選項:
使用全局首選項–使用“ HTTP設置”全局首選項中定義的設置。
搶先驗證–僅針對此請求。 不要等到收到授權挑戰以發送憑據。
我已經看到在C#中有一個搶占式身份驗證設置,但是我沒有找到任何與PowerShell等效的設置。
有人遇到過這個問題嗎? Powershell有沒有辦法發布搶先式身份驗證?
這就是我所擁有的,但這只是基本設置...
$base64AuthInfo =
[Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f
$user, $pass)))
$headers = New-Object "System.Collections.Generic.Dictionary[[String], String]]"
$headers = @{}
$headers.Add('Authorization',('Basic {0}' -f $base64AuthInfo))
$headers.Add('X-IBM-Client-ID', $clientId )
$uri = "https://myURI/development/authorization/token"
$invoke = Invoke-RestMethod -Headers $headers -Method Post -Uri $uri
通過運氣...這修復了搶先式身份驗證
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.