dongmu4591 2017-06-29 20:04
浏览 270

使用Golang的Windows NTLM身份验证

Need to make http call using golang client (net/http) which requires integrated windows authentication (NTLM) (similar issue ) its not working.. - i am not what am missing below is the code that i use.. (package used - ntlmssp "github.com/Azure/go-ntlmssp")

client := &http.Client{
    Transport: ntlmssp.Negotiator{
        RoundTripper: &http.Transport{},
    },
}

req, _ := http.NewRequest("GET", url1, nil)

req.SetBasicAuth("login", "password") 

res, err := client.Do(req)

I get the error the following response ..

{401 Unauthorized 401 HTTP/1.1 1 1 map[Content-Type:[text/html] Server:[Microsoft-IIS/8.5] Www-Authenticate:[NTLM Negotiate]

Appears to work when i run against a local webserver which has windows auth enabled... differene i notice is in the IIS version - not sure how it impacts NTLM...

200 OK 200 HTTP/1.1 1 1 map[Content-Type:[text/html] Accept-Ranges:[bytes] Server:[Microsoft-IIS/10.0] Persistent-Auth:[true] L

In addition.. when i notice the NTLM handshake - this is what i see (not very familiar with NTLM handshake/what it would imply... ) so not sure if this means anything...

When it works the authorization tags to Negotiate When it works the authorization tags to Negotiate

but when it fails the authorization tags to NTLM but when it fails the authorization tags to NTLM

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于R语言单因素与多因素线性回归的平均值
    • ¥15 服务器清除BIOS之后引导不了
    • ¥15 CPLEX用OPL编写的混合整数线性优化问题。
    • ¥15 可以用EasyConnect连接实验室内网,但无法连接内网才能访问的服务器,为什么?
    • ¥15 前端预览docx文件,文件从后端传送过来。
    • ¥15 层次聚类和蛋白质相似度
    • ¥25 主成分分析中的第一第二主成分分别代表哪些参数
    • ¥15 oracle数据库查询语句问题
    • ¥15 有没有c++绘制算法的佬们吗救孩一下
    • ¥15 android 蓝牙闪退