Alternative NTLM
NTLM handshake authentication
The default NTLM authentication uses go-ntlmssp - the great package by Azure team. However, we found rare environments where it fails for some reason. Fortunately, there is an alternative.

Usage sample

1
package main
2
3
import (
4
"fmt"
5
"log"
6
"os"
7
8
"github.com/koltyakov/gosip"
9
"github.com/koltyakov/gosip/api"
10
strategy "github.com/koltyakov/gosip-sandbox/strategies/ntlm"
11
)
12
13
func main() {
14
15
authCnfg := &strategy.AuthCnfg{
16
SiteURL: os.Getenv("SPAUTH_SITEURL"),
17
Username: os.Getenv("SPAUTH_USERNAME"),
18
Domain: os.Getenv("SPAUTH_DOMAIN"),
19
Password: os.Getenv("SPAUTH_PASSWORD"),
20
}
21
22
client := &gosip.SPClient{AuthCnfg: authCnfg}
23
sp := api.NewSP(client)
24
25
res, err := sp.Web().Select("Title").Get()
26
if err != nil {
27
log.Fatal(err)
28
}
29
30
fmt.Printf("Site title: %s\n", res.Data().Title)
31
32
}
Copied!
Use the alternative only as a fallback method if go-ntlmssp doesn't work and don't forget to post an issue to help making Open Source tools better.
Export as PDF
Copy link
Contents
Usage sample