【问题标题】:How to authenticate without sending my username and password for HTTP requests?如何在不发送 HTTP 请求的用户名和密码的情况下进行身份验证?
【发布时间】:2018-12-23 14:58:47
【问题描述】:

目前,以下是我从 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

但我不想再像这样提及我的用户名和密码了。 对于从 TeamCity Build Step 到 PS 发出的 HTTP 请求,我还有哪些其他方法可以验证自己的身份?

【问题讨论】:

标签: powershell continuous-integration teamcity


【解决方案1】:

必须使用基本身份验证,但不是使用我自己的凭据,而是使用由公司中每个人都可以使用的开发操作创建的超级用户。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多