如何在不发送HTTP请求的用户名和密码的情况下进行身份验证?

时间:2017-09-18 05:30:47

标签: powershell continuous-integration teamcity

目前,以下是我如何从PS发送更新参数的请求:

$pair="$("username"):$("password")"
$encodedCreds=[System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue="Basic $encodedCreds"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $basicAuthValue)
$headers.Add("Content-Type", 'text/plain')
$headers.Add("Origin", 'https://teamcity.server.io')
Invoke-RestMethod -Method Put -Uri $url -Headers $headers -Body $updated_version

但我不希望我的用户名和密码再次提及。 我还有哪些其他方法可以通过PS来验证TeamCity Build Step中的HTTP请求?

1 个答案:

答案 0 :(得分:0)

必须使用基本身份验证,但不是使用我自己的凭据,而是使用了由开发运营人员创建的超级用户,该超级用户可用于公司中的每个人。