You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With correct credentials for NTLM auth strategy, fails with 401.
This happens in some environment, didn't get the consistent pattern yet. But found a workaround.
package main
import (
"flag""log""strings""github.com/koltyakov/gosip"
strategy "github.com/koltyakov/gosip/auth/ntlm"
httpntlm "github.com/vadimi/go-http-ntlm"
)
var (
siteURL=flag.String("siteUrl", "", "SharePoint site URL")
username=flag.String("username", "", "SharePoint user name, must be in the following format `domain\\username`")
password=flag.String("password", "", "SharePoint password")
)
funcmain() {
flag.Parse()
auth:=&strategy.AuthCnfg{
SiteURL: *siteURL,
Username: *username,
Password: *password,
}
client:=&gosip.SPClient{
AuthCnfg: auth,
}
// Workaround >>>if!strings.Contains(*username, "\\") {
log.Fatal("incorrect username format, must be in the following format `domain\\username`")
}
client.Transport=&httpntlm.NtlmTransport{
Domain: strings.Split(*username, "\\")[0],
User: strings.Split(*username, "\\")[1],
Password: *password,
}
// <<<// Go with SP
}
I'm not planning to migrate to https://github.com/vadimi/go-http-ntlm immediately but wait some time for a response in go-ntlmssp. While a workaround exists, it's not a blocker. Also, finding a consistency pattern might be useful for applying a fix in Azure's library.
The text was updated successfully, but these errors were encountered:
koltyakov
changed the title
NTML strategy: 401 Unauthenticated error with a correct credentials on some environments
NTLM strategy: 401 Unauthenticated error with a correct credentials on some environments
Jun 17, 2021
With correct credentials for NTLM auth strategy, fails with 401.
This happens in some environment, didn't get the consistent pattern yet. But found a workaround.
Relevant issues in
go-ntlmssp
: Azure/go-ntlmssp#12, Azure/go-ntlmssp#16, Azure/go-ntlmssp#14The workaround is using https://github.com/vadimi/go-http-ntlm, a patch-like usage with current
gosip
version is:I'm not planning to migrate to https://github.com/vadimi/go-http-ntlm immediately but wait some time for a response in go-ntlmssp. While a workaround exists, it's not a blocker. Also, finding a consistency pattern might be useful for applying a fix in Azure's library.
The text was updated successfully, but these errors were encountered: